Example #1
2
  AdminMain() {
    l = new JLabel();
    l.setBounds(10, 20, 1340, 1000);
    l.setBackground(Color.black);
    Font ft = new Font("Arial", Font.BOLD, 30);
    Font ft1 = new Font("Arial", Font.BOLD, 14);
    Font ft2 = new Font("Arial", Font.BOLD, 20);

    f1 = new Frame("Soft Test Management (Beta)");
    f1.setLayout(null);

    l1 = new Label("Test Instructions", l1.CENTER);
    l1.setBounds(10, 20, 1300, 60);
    l1.setForeground(Color.blue);
    l1.setBackground(Color.white);
    l1.setFont(ft);

    l2 = new JLabel("Deletion of Faculty/Students");
    l2.setBounds(20, 30, 1000, 500);
    l2.setBackground(Color.blue);
    l2.setFont(ft2);
    l3 = new JLabel("Test Pattern");
    l3.setBounds(20, 90, 1300, 500);
    l3.setBackground(Color.green);
    l3.setFont(ft2);

    b1 = new JButton("Go !");
    b1.setBounds(300, 220, 120, 30);
    b1.setBackground(Color.white);
    b1.setForeground(Color.blue);
    b1.setFont(ft2);

    b2 = new JButton("Go");
    b2.setBounds(300, 240, 120, 30);
    b2.setBackground(Color.white);
    b2.setForeground(Color.blue);
    b2.setFont(ft2);

    f1.add(l);
    l.add(l1);
    l2.add(b1);
    l.add(l2);
    l3.add(b2);
    l.add(l3);

    b1.addActionListener(this);
    b2.addActionListener(this);

    f1.setVisible(true);
    f1.setSize(1800, 800);
  }
Example #2
0
  /*
   * 初始化窗口变量
   */
  public void initframe() {
    flogin.setTitle("欢迎来到江西农业大学");
    userName = new JLabel("用户名:");
    userName.setForeground(Color.white);
    userName.setFont(new Font("宋体", Font.BOLD, 15));
    userPassword = new JLabel("密  码:");
    userPassword.setForeground(Color.white);
    userPassword.setFont(new Font("宋体", Font.BOLD, 15));
    passWd = new JPasswordField(12);
    user = new JTextField(12);
    signIn = new JButton("登录");
    signIn.setFont(new Font("宋体", Font.BOLD, 15));
    signIn.setBackground(new Color(10, 97, 190));

    signIn.setForeground(Color.white);
    reset = new JButton("重置");
    reset.setBackground(Color.blue);
    reset.setForeground(Color.white);
    reset.setFont(new Font("宋体", Font.BOLD, 15));
    reset.setBackground(new Color(10, 97, 190));
    checkno = new JLabel("验证码:");
    checkno.setForeground(Color.white);
    checkno.setFont(new Font("宋体", Font.BOLD, 15));
    checktflogin = new JTextField(12);
  }
Example #3
0
  public void go() throws Exception {
    if (!no_channel && !use_state) {
      channel.connect(groupname);
    }
    mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    panel = new DrawPanel(use_state);
    panel.setBackground(background_color);
    sub_panel = new JPanel();
    mainFrame.getContentPane().add("Center", panel);
    clear_button = new JButton("Clear");
    clear_button.setFont(default_font);
    clear_button.addActionListener(this);
    leave_button = new JButton("Leave");
    leave_button.setFont(default_font);
    leave_button.addActionListener(this);
    sub_panel.add("South", clear_button);
    sub_panel.add("South", leave_button);
    mainFrame.getContentPane().add("South", sub_panel);
    mainFrame.setBackground(background_color);
    clear_button.setForeground(Color.blue);
    leave_button.setForeground(Color.blue);
    mainFrame.pack();
    mainFrame.setLocation(15, 25);
    mainFrame.setBounds(new Rectangle(250, 250));

    if (!no_channel && use_state) {
      channel.connect(groupname, null, null, state_timeout);
    }
    mainFrame.setVisible(true);
    setTitle();
  }
    @Override
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      if (isSelected) {
        renderButton.setForeground(table.getSelectionForeground());
        renderButton.setBackground(table.getSelectionBackground());
      } else {
        renderButton.setForeground(table.getForeground());
        renderButton.setBackground(UIManager.getColor("Button.background"));
      }

      renderButton.setFocusPainted(hasFocus);

      if (value == null) {
        renderButton.setText("");
        renderButton.setIcon(null);
      } else if (value instanceof Icon) {
        renderButton.setText("");
        renderButton.setIcon((Icon) value);
      } else {
        renderButton.setText(value.toString());
        renderButton.setIcon(null);
      }
      return renderButton;
    }
Example #5
0
 /** Sets the enabled flag of the {@link #login} button. */
 private void enableControls() {
   boolean enabled = true;
   String s = serverText.getText();
   char[] name = pass.getPassword();
   String usr = user.getText().trim();
   if (CommonsLangUtils.isBlank(s) || CommonsLangUtils.isBlank(usr)) {
     enabled = false;
   } else {
     s = s.trim();
     if (DEFAULT_SERVER.equals(s)) {
       enabled = false;
     }
   }
   login.setEnabled(enabled);
   if (enabled) {
     ActionListener[] listeners = login.getActionListeners();
     if (listeners != null) {
       boolean set = false;
       for (int i = 0; i < listeners.length; i++) {
         if (listeners[i] == this) {
           set = true;
           break;
         }
       }
       if (!set) login.addActionListener(this);
     }
     login.setForeground(defaultForeground);
   } else {
     login.setForeground(FOREGROUND_COLOR);
   }
   layout(hasGroupOption());
 }
  /**
   * Init JWhiteBoard interface
   *
   * @throws Exception
   */
  public void go() throws Exception {
    if (!noChannel && !useState) channel.connect(groupName);
    mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    drawPanel = new DrawPanel(useState);
    drawPanel.setBackground(backgroundColor);
    subPanel = new JPanel();
    mainFrame.getContentPane().add("Center", drawPanel);
    clearButton = new JButton("Clean");
    clearButton.setFont(defaultFont);
    clearButton.addActionListener(this);
    leaveButton = new JButton("Exit");
    leaveButton.setFont(defaultFont);
    leaveButton.addActionListener(this);
    subPanel.add("South", clearButton);
    subPanel.add("South", leaveButton);
    mainFrame.getContentPane().add("South", subPanel);
    mainFrame.setBackground(backgroundColor);
    clearButton.setForeground(Color.blue);
    leaveButton.setForeground(Color.blue);
    mainFrame.pack();
    mainFrame.setLocation(15, 25);
    mainFrame.setBounds(new Rectangle(250, 250));

    if (!noChannel && useState) {
      channel.connect(groupName, null, stateTimeout);
    }
    mainFrame.setVisible(true);
  }
  /**
   * Initializes the components.
   *
   * @param nameSpace The name space to use to determine the name.
   * @param index The value of the results.
   */
  private void initComponents(String nameSpace, int index) {
    attachments = new ArrayList<FileAnnotationData>();
    this.nameSpace = nameSpace;
    resultsButton = new JButton();
    resultsButton.setText(convertNameSpace(nameSpace) + " #" + index);
    resultsButton.setOpaque(false);
    resultsButton.setForeground(UIUtilities.HYPERLINK_COLOR);
    resultsButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    UIUtilities.unifiedButtonLookAndFeel(resultsButton);
    resultsButton.setActionCommand("" + VIEW);
    resultsButton.addActionListener(this);

    cancelButton = new JButton();
    cancelButton.setText("Cancel");
    cancelButton.setToolTipText("Cancel results loading.");
    cancelButton.setOpaque(false);
    cancelButton.setForeground(UIUtilities.HYPERLINK_COLOR);
    cancelButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    UIUtilities.unifiedButtonLookAndFeel(cancelButton);
    cancelButton.setActionCommand("" + CANCEL);
    cancelButton.addActionListener(this);

    IconManager icons = IconManager.getInstance();
    deleteButton = new JMenuItem(icons.getIcon(IconManager.DELETE_12));
    deleteButton.setText("Delete");
    deleteButton.setToolTipText("Delete the results.");
    deleteButton.setActionCommand("" + DELETE);
    deleteButton.addActionListener(this);
    downloadButton = new JMenuItem(icons.getIcon(IconManager.DOWNLOAD_12));
    downloadButton.setText("Download...");
    downloadButton.setToolTipText("Download the selected file.");
    downloadButton.setActionCommand("" + DOWNLOAD);
    downloadButton.addActionListener(this);

    menuButton = new JButton(icons.getIcon(IconManager.UP_DOWN_9_12));
    UIUtilities.unifiedButtonLookAndFeel(menuButton);
    menuButton.setBackground(UIUtilities.BACKGROUND_COLOR);
    menuButton.addMouseListener(
        new MouseAdapter() {

          public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            showMenu(menuButton, p);
          }
        });
    infoButton = new JMenuItem(icons.getIcon(IconManager.INFO));
    infoButton.setText("Info...");
    infoButton.addMouseListener(
        new MouseAdapter() {

          public void mousePressed(MouseEvent e) {
            Point p = e.getPoint();
            displayInformation(p);
          }
        });

    setBackground(UIUtilities.BACKGROUND_COLOR);
  }
Example #8
0
  public Perfil() {
    super.setBounds(181, 61, 700, 538); // (ancho,alto)
    super.setLayout(null);
    super.setOpaque(false);
    super.setVisible(false);

    try {
      UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    jbtnGuardar = new JButton("Guardar Cambios");
    jbtnGuardar.setBounds(55, 457, 150, 40);
    jbtnGuardar.addActionListener(this);
    jbtnGuardar.setBorder(null);
    jbtnGuardar.setBackground(new Color(0, 154, 225));
    jbtnGuardar.setForeground(Color.WHITE);
    jbtnGuardar.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnGuardar.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnGuardar.setFocusPainted(false);
    this.add(jbtnGuardar);

    nombre = new JLabel("Ninguna imagen seleccionada");
    nombre.setBounds(210, 250, 200, 40);
    nombre.setForeground(Color.GRAY);
    this.add(nombre);

    jbtnCargarI = new JButton("Cargar imagen");
    jbtnCargarI.setBounds(55, 250, 150, 40);
    jbtnCargarI.addActionListener(this);
    jbtnCargarI.setBorder(null);
    jbtnCargarI.setBackground(new Color(0, 154, 225));
    jbtnCargarI.setForeground(Color.WHITE);
    jbtnCargarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnCargarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnCargarI.setFocusPainted(false);
    this.add(jbtnCargarI);

    jbtnQuitarI = new JButton("Quitar imagen");
    jbtnQuitarI.setBounds(55, 186, 150, 40);
    jbtnQuitarI.addActionListener(this);
    jbtnQuitarI.setBorder(null);
    jbtnQuitarI.setBackground(new Color(0, 154, 225));
    jbtnQuitarI.setForeground(Color.WHITE);
    jbtnQuitarI.setFont(new Font("Segoe UI", Font.PLAIN, 14));
    jbtnQuitarI.setCursor(new Cursor(java.awt.Cursor.HAND_CURSOR));
    jbtnQuitarI.setFocusPainted(false);
    this.add(jbtnQuitarI);

    jlbimage = new JLabel();
    jlbimage.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
    jlbimage.setBounds(55, 46, 150, 150);
    this.add(jlbimage);

    this.repaint();
  }
Example #9
0
    public void actionPerformed(ActionEvent e) {
      JButton source = (JButton) e.getSource();
      _usrVotes[_index] = source.getText();

      for (JButton b : _candidateButtons) {
        b.setForeground(Color.BLACK);
      }
      source.setForeground(Color.RED);

      System.out.println("Vote for " + _title + " is " + _usrVotes[_index]);
    }
Example #10
0
 /*
  * (non-Javadoc)
  *
  * @see
  * javax.swing.DefaultCellEditor#getTableCellEditorComponent(javax.swing
  * .JTable, java.lang.Object, boolean, int, int)
  */
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   if (isSelected) {
     button.setForeground(table.getSelectionForeground());
     button.setBackground(table.getSelectionBackground());
   } else {
     button.setForeground(table.getForeground());
     button.setBackground(table.getBackground());
   }
   return button;
 }
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   if (isSelected) {
     button.setForeground(table.getSelectionForeground());
     button.setBackground(table.getSelectionBackground());
   } else {
     button.setForeground(table.getForeground());
     button.setBackground(table.getBackground());
   }
   label = "Delete";
   eaInt_SeletedRow = row;
   isPushed = true;
   return button;
 }
Example #12
0
  public static void Form_Del() throws Exception {
    frame.setTitle(
        "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u043A\u043E\u043D\u0442\u0430\u043A\u0442");
    frame.getContentPane().setForeground(new Color(255, 255, 255));
    frame.getContentPane().setBackground(new Color(255, 204, 153));
    frame.getContentPane().setLayout(null);

    textField = new JTextField();
    textField.setBounds(162, 18, 163, 26);
    frame.getContentPane().add(textField);
    textField.setColumns(10);

    JLabel lblNewLabel =
        new JLabel(
            "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043D\u043E\u043C\u0435\u0440 \u0432 \u0441\u043F\u0438\u0441\u043A\u0435");
    lblNewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 14));
    lblNewLabel.setBounds(10, 11, 163, 38);
    frame.getContentPane().add(lblNewLabel);

    JButton button = new JButton("\u0423\u0434\u0430\u043B\u0438\u0442\u044C");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            Integer i = Integer.valueOf(textField.getText());
            Contacts.Delete(i);
            Contacts.Updates();
            textField.setText(" ");
            frame.dispose();
          }
        });
    button.setForeground(new Color(153, 0, 102));
    button.setBackground(new Color(255, 255, 204));
    button.setBounds(172, 48, 153, 23);
    frame.getContentPane().add(button);

    JButton button_1 = new JButton("\u041E\u0442\u043C\u0435\u043D\u0430");
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            textField.setText(" ");
          }
        });
    button_1.setForeground(new Color(153, 0, 102));
    button_1.setBackground(new Color(204, 255, 204));
    button_1.setBounds(10, 48, 152, 23);
    frame.getContentPane().add(button_1);
    frame.setSize(351, 124);
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setVisible(true);
  }
Example #13
0
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   if (isSelected) {
     button.setForeground(table.getSelectionForeground());
     button.setBackground(table.getSelectionBackground());
   } else {
     button.setForeground(table.getForeground());
     button.setBackground(table.getBackground());
   }
   label = (value == null) ? "" : value.toString();
   button.setText(label);
   isPushed = true;
   return button;
 }
  public void redrawCommande() {
    itemPanel.removeAll();
    OrderedItem orders[] = commande.getOrders();
    GridBagConstraints c = new GridBagConstraints();
    c.gridy = GridBagConstraints.RELATIVE;
    c.fill = GridBagConstraints.BOTH;
    for (int i = 0; i < orders.length; i++) {
      c.gridx = 0;

      JPanel itemLabelHolder = new JPanel();
      itemLabelHolder.add(new JLabel(orders[i].getItem().getNom()));
      itemLabelHolder.setBackground(Color.WHITE);
      itemLabelHolder.setBorder(BorderFactory.createLineBorder(Color.BLUE));

      itemPanel.add(itemLabelHolder, c);
      c.gridx = 1;
      itemPanel.add(new OrderedItemPanel(orders[i]), c);
      c.gridx = 2;
      JButton killButton = new JButton("\u2716");
      killButton.setBackground(Color.RED);
      killButton.setForeground(Color.WHITE);
      killButton.addActionListener(getHandler());
      killButton.setActionCommand("CDelete" + i);
      JPanel buttonHolder = new JPanel();
      buttonHolder.add(killButton);

      itemPanel.add(buttonHolder, c);
    }
    validate();
    repaint();
  }
Example #15
0
 void setCopyright(String copyright) {
   Component c = null;
   if (copyrightUrl == null) {
     JLabel l = new JLabel("(" + copyright + ")");
     c = l;
     gc.insets.bottom = 0;
   } else {
     JButton b = new JButton(copyright != null ? copyright : "Copyright");
     b.setFont(b.getFont().deriveFont(Font.ITALIC));
     b.setForeground(Color.blue);
     b.setBackground(background);
     b.setContentAreaFilled(false);
     b.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.blue));
     b.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             loadCopyright();
           }
         });
     c = b;
     gc.insets.bottom = 5;
   }
   gb.setConstraints(c, gc);
   getPanel().add(c);
 }
Example #16
0
  public JFrameMain() {
    super("¿â´æ¹ÜÀí");
    getContentPane().setLayout(null);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    btn_transfer = new JButton("\u4ED3\u5E93\u8C03\u62E8");
    btn_transfer.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_transfer.setBackground(Color.YELLOW);
    btn_transfer.setBounds(59, 73, 93, 23);
    getContentPane().add(btn_transfer);

    btn_search = new JButton("\u62A5\u635F\u62A5\u6EA2");
    btn_search.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_search.setBackground(Color.MAGENTA);
    btn_search.setBounds(59, 135, 93, 23);
    getContentPane().add(btn_search);

    btn_loss = new JButton("\u8FC7\u671F\u67E5\u8BE2");
    btn_loss.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_loss.setBackground(Color.RED);
    btn_loss.setBounds(225, 73, 93, 23);
    getContentPane().add(btn_loss);

    btn_change = new JButton("\u5E93\u5B58\u53D8\u52A8");
    btn_change.addMouseListener(new MainFrame_btn_mouseListener(this));
    btn_change.setForeground(new Color(0, 0, 0));
    btn_change.setBackground(new Color(0, 255, 255));
    btn_change.setBounds(225, 135, 93, 23);
    getContentPane().add(btn_change);
  }
  public void go() {
    picture();
    ActionListener listener = new BtListener();
    go.addActionListener(listener);
    btn_update_manual.addActionListener(listener);
    go.setForeground(Color.black);
    // rights.setFont((new Font("Arial", Font.PLAIN, 12)));
    title.setFont((new Font("Arial", Font.BOLD, 36)));
    title.setForeground(new Color(238, 253, 253));
    today.setFont((new Font("Arial", Font.BOLD, 16)));
    today.setForeground(new Color(163, 184, 204));
    frame.setLayout(new BorderLayout());
    from.setBackground(Color.white);
    to.setBackground(Color.white);
    converted.setFont(new Font("Arial", Font.BOLD, 24));
    converted.setForeground(new Color(238, 253, 253));
    Lfrom.setForeground(new Color(238, 253, 253));
    Lto.setForeground(new Color(238, 253, 253));
    quantity.setForeground(new Color(238, 253, 253));
    Lfrom.setFont(new Font("Arial", Font.BOLD, 24));
    Lto.setFont(new Font("Arial", Font.BOLD, 24));
    quantity.setFont(new Font("Arial", Font.BOLD, 24));
    north.setLayout(new FlowLayout());
    north.add(title);
    north.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.NORTH, north);
    inner.setLayout(new BorderLayout());
    inner.add(BorderLayout.NORTH, today);
    inner.add(BorderLayout.WEST, picPanel);
    center.setLayout(new GridLayout(2, 4, 5, 5));
    center.add(Lfrom);
    center.add(from);
    center.add(Lto);
    center.add(to);
    center.add(quantity);
    center.add(amount);
    center.add(go);
    inner.setBackground(new Color(59, 62, 71));
    inner.add(BorderLayout.SOUTH, center);
    center.setBackground(new Color(59, 62, 71));
    frame.add(BorderLayout.CENTER, inner);
    south.setBackground(new Color(59, 62, 71));
    south.setLayout(new FlowLayout());
    south.add(converted);
    south.add(answer);
    south.add(btn_update_manual);
    // south.add(rights);
    frame.add(BorderLayout.SOUTH, south);
    frame.setSize(850, 700);
    frame.setVisible(true);

    frame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent event) {
            frame.setVisible(false);
            frame.dispose();
            System.exit(0);
          }
        });
  }
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    if (hasFocus) {
      renderButton.setForeground(table.getForeground());
      renderButton.setBackground(UIManager.getColor("Button.background"));
    } else if (isSelected) {
      renderButton.setForeground(table.getSelectionForeground());
      renderButton.setBackground(table.getSelectionBackground());
    } else {
      renderButton.setForeground(table.getForeground());
      renderButton.setBackground(UIManager.getColor("Button.background"));
    }

    renderButton.setText("Detalhar");
    return renderButton;
  }
Example #19
0
  public void actionPerformed(ActionEvent a) {
    JButton pressedButton = (JButton) a.getSource();

    if (pressedButton.getText().equals("")) {
      pressedButton.setText("X");
      pressedButton.setForeground(Color.blue);
      copie_tabla = copie_tabla();
      counts += 1;
      checkWin();
      long inicio = System.currentTimeMillis();
      int poz_max = min_max(copie_tabla);
      long fim = System.currentTimeMillis();

      System.out.println("Tempo de Execução: " + (fim - inicio) + "ms");
      buttons[poz_max].setText("O");
      buttons[poz_max].setForeground(Color.red);
      counts += 1;
      checkWin();

    } else {
      Toolkit.getDefaultToolkit().beep();
      JOptionPane.showMessageDialog(
          null, "Escolha outro movimento!!!!", "Jogo Da Velha ", JOptionPane.ERROR_MESSAGE);
    }
  }
 public void init() {
   Container cp = getContentPane();
   root = new DefaultMutableTreeNode("root");
   tree = new JTree(root);
   // Add it and make it take care of scrolling:
   cp.add(new JScrollPane(tree), BorderLayout.CENTER);
   // Capture the tree's model:
   model = (DefaultTreeModel) tree.getModel();
   JButton test = new JButton("Press me");
   test.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           if (i < data.length) {
             child = new Branch(data[i++]).node();
             // What's the last one you clicked?
             chosen = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
             if (chosen == null) chosen = root;
             // The model will create the appropriate event.
             // In response, the tree will update itself:
             model.insertNodeInto(child, chosen, 0);
             // Puts the new node on the chosen node.
           }
         }
       });
   // Change the button's colors:
   test.setBackground(Color.BLUE);
   test.setForeground(Color.WHITE);
   JPanel p = new JPanel();
   p.add(test);
   cp.add(p, BorderLayout.SOUTH);
 }
  private void buildPanel() {
    messageLabel = new JLabel("Enter a distance in Kilometers");

    kiloTextField = new JTextField(10);

    setColorCyan = new JButton("Cyanize");
    setColorGreen = new JButton("makeGreen");

    calcButton = new JButton("Calcumalate");

    ImageIcon image1 = new ImageIcon("10d.jpg");
    image = new JLabel(image1);
    calcButton.setForeground(Color.BLUE);

    calcButton.addActionListener(new calcButtonListener());
    setColorCyanListener listener = new setColorCyanListener();
    setColorCyan.addActionListener(listener);

    setColorGreenListener listenerG = new setColorGreenListener();
    setColorGreen.addActionListener(listenerG);
    calcButton.setIcon(image1);
    panel = new JPanel();

    panel.setLayout(new GridLayout(3, 3));
    panel.setBackground(Color.RED);
    panel.add(messageLabel);
    panel.add(kiloTextField);
    panel.add(calcButton);
    panel.add(setColorCyan);
    panel.add(setColorGreen);
    panel.add(image);
  }
 /**
  * Shows a color chooser dialog and changes the foreground color of the button which is initiating
  * the dialog.
  *
  * @param aButton The button initiating the dialog
  */
 private void showColorChooser(JButton aButton) {
   Color newColor = JColorChooser.showDialog(this, "Choose Text Color", aButton.getForeground());
   if (null != newColor) {
     aButton.setForeground(newColor);
     onChange();
   }
 } // END private void showColorChooser(JButton)
Example #23
0
  public Console() {
    super("Javacalculus Test GUI");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    System.setOut(new PrintStream(new consoleOutputStream()));
    // System.setErr(new PrintStream(new consoleOutputStream(true)));
    inputLabel.setLabelFor(input);
    input.setPreferredSize(new Dimension(300, 20));
    input.setBorder(BorderFactory.createLoweredBevelBorder());
    input.addKeyListener(this);
    commandHistory.add("");
    execute.addActionListener(this);
    execute.setBackground(Color.GREEN);
    execute.setForeground(Color.WHITE);
    console.setLineWrap(true);
    console.setWrapStyleWord(true);
    console.setEditable(false);
    console.setFont(new Font("Dialog", Font.BOLD, 14));
    JScrollPane consolePane =
        new JScrollPane(
            console,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    consolePane.setPreferredSize(new Dimension(600, 300));
    consolePane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		error.setLineWrap(true);
    //		error.setWrapStyleWord(true);
    //		error.setEditable(false);
    //    	error.setFont(new Font("Dialog", Font.ITALIC, 12));
    //		JScrollPane errorPane = new JScrollPane(error, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    //				JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    //		errorPane.setBorder(BorderFactory.createLoweredBevelBorder());
    //		errorPane.setPreferredSize(new Dimension(600,300));
    // content.setPreferredSize(new Dimension(400,400));
    content.setLayout(new GridBagLayout());
    content.setBorder(BorderFactory.createLoweredBevelBorder());
    GridBagConstraints c = new GridBagConstraints();

    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    content.add(inputLabel, c);
    c.gridx = 1;
    c.gridy = 0;
    content.add(input, c);
    c.gridx = 2;
    c.gridy = 0;
    content.add(execute, c);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 3;
    content.add(consolePane, c);
    //		c.gridx = 0; c.gridy = 2;
    //		content.add(errorPane, c);
    add(content);

    pack();
    setVisible(true);
    input.requestFocus();
  }
Example #24
0
 @Override
 public Component getTableCellEditorComponent(
     JTable table, Object value, boolean isSelected, int row, int column) {
   this.row = row;
   if (isSelected) {
     button.setForeground(Color.white);
     button.setBackground(Color.white);
   } else {
     button.setForeground(Color.white);
     button.setBackground(Color.white);
   }
   button.setText("");
   button.setIcon(new ImageIcon(getClass().getResource("/img/down.png")));
   isPushed = true;
   return button;
 }
Example #25
0
 @Override
 public Component getListCellRendererComponent(
     JList<? extends E> list, E value, int index, boolean isSelected, boolean cellHasFocus) {
   label.setText(Objects.toString(value, ""));
   this.list = list;
   this.index = index;
   if (isSelected) {
     setBackground(list.getSelectionBackground());
     label.setForeground(list.getSelectionForeground());
   } else {
     setBackground(index % 2 == 0 ? EVEN_COLOR : list.getBackground());
     label.setForeground(list.getForeground());
   }
   MutableComboBoxModel m = (MutableComboBoxModel) list.getModel();
   if (index < 0 || m.getSize() - 1 <= 0) {
     setOpaque(false);
     deleteButton.setVisible(false);
     label.setForeground(list.getForeground());
   } else {
     boolean f = index == rolloverIndex;
     setOpaque(true);
     deleteButton.setVisible(true);
     deleteButton.getModel().setRollover(f);
     deleteButton.setForeground(f ? Color.WHITE : list.getForeground());
   }
   return this;
 }
  public ProgressDialog(Frame owner, String title) {
    super(owner, title);

    openProgressButton.setToolTipText("Console");
    openProgressButton.setBackground(Color.WHITE);
    openProgressButton.setForeground(Color.WHITE);
    openProgressButton.setIcon(
        new ImageIcon(DBSGeneralPanel.class.getResource("/img/console.png")));
    openProgressButton.setOpaque(false);
    openProgressButton.setContentAreaFilled(false);
    openProgressButton.setBorderPainted(false);
    openProgressButton.setFocusPainted(false);
    openProgressButton.setVisible(
        false); // By default set as invisible until collection is executed.

    progressTextArea.setEditable(false);
    // this.setLocationRelativeTo(openProgressButton);
    this.setModalityType(Dialog.ModalityType.valueOf("APPLICATION_MODAL"));
    this.add(progressScrollPane);
    this.setSize(1200, 400);

    openProgressButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            ProgressDialog.this.setLocationRelativeTo(ProgressDialog.this.openProgressButton);
            ProgressDialog.this.setVisible(true);
          }
        });
  }
Example #27
0
  /** Create the panel. */
  public Screen13() {
    setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    setBackground(Color.WHITE);
    setBounds(0, 0, 500, 500);
    setLayout(null);

    JLabel lblNewLabel = new JLabel("Please insert deposit into deposit slot");
    lblNewLabel.setFont(new Font("Avenir Next", Font.PLAIN, 18));
    lblNewLabel.setBounds(96, 227, 309, 25);
    add(lblNewLabel);

    JButton tryAgainButton = new JButton("Done");
    tryAgainButton.setForeground(new Color(0, 128, 128));
    // enterButton.setBackground(new Color(0, 128, 0));
    tryAgainButton.setFont(new Font("Avenir Next", Font.PLAIN, 30));
    Color enterButtonColor = Color.decode("#6365ff");
    tryAgainButton.setBackground(enterButtonColor);

    // --------------------------------
    // MARK: - Try Again Button Tapped
    // --------------------------------
    tryAgainButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            // move to screen 14
            SATMGUI satmGui = (SATMGUI) getParent().getParent().getParent().getParent();
            satmGui.changeCards("14");
          }
        });
    tryAgainButton.setBounds(150, 379, 201, 49);
    add(tryAgainButton);
  }
Example #28
0
 /**
  * This method initializes jButtonLogout
  *
  * @return javax.swing.JButton
  */
 private JButton getJButtonLogout() {
   if (jButtonLogout == null) {
     jButtonLogout = new JButton();
     jButtonLogout.setText("Log Out");
     jButtonLogout.setFont(new Font("Arial", Font.BOLD, 12));
     jButtonLogout.setSelected(false);
     jButtonLogout.setMnemonic(KeyEvent.VK_UNDEFINED);
     jButtonLogout.setComponentOrientation(ComponentOrientation.UNKNOWN);
     jButtonLogout.setBounds(new Rectangle(8, 30, 80, 40));
     jButtonLogout.setForeground(Color.white);
     jButtonLogout.setFont(new Font("Arial", Font.BOLD, 12));
     jButtonLogout.setBackground(new Color(91, 155, 213));
     jButtonLogout.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             int option =
                 JOptionPane.showConfirmDialog(
                     myFrame, "Do You want to exit?", "Confirmation", JOptionPane.YES_NO_OPTION);
             if (option == JOptionPane.YES_OPTION) {
               JPanel panel = new LobbyLoginPanel(myFrame);
               myFrame.getContentPane().removeAll();
               myFrame.getContentPane().add(panel);
               myFrame.getContentPane().validate();
               myFrame.getContentPane().repaint();
             }
           }
         });
   }
   return jButtonLogout;
 }
 /**
  * This method initializes jButtonDone
  *
  * @return javax.swing.JButton
  */
 private JButton getJButtonDone() {
   if (jButtonDone == null) {
     jButtonDone = new JButton();
     jButtonDone.setBounds(new Rectangle(286, 496, 142, 57));
     jButtonDone.setFont(new Font("Calibri", Font.BOLD, 36));
     jButtonDone.setForeground(Color.white);
     jButtonDone.setToolTipText("");
     jButtonDone.setText("Done");
     jButtonDone.setBackground(new Color(91, 155, 213));
     jButtonDone.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             errorMessage.setText("");
             String name = jTextFieldFullName.getText();
             String NRIC = jTextFieldID.getText();
             String username = jTextFieldUsername.getText();
             person = PersonDAO.searchByUsername(username);
             boolean checkIdentity = checkIdentity(name, NRIC, username);
             if (checkIdentity == true) {
               sendEmail();
               try {
                 PersonDAO.updatePersonPassword(inputPassword, username);
               } catch (SQLException e1) {
                 e1.printStackTrace();
               }
             } else {
               errorMessage.setForeground(Color.red);
               errorMessage.setText(errorMessage.getText() + "The credentials do not match! \n");
             }
           }
         });
   }
   return jButtonDone;
 }
Example #30
0
  public Gui() throws IOException {
    setSize(1024, 798);
    setBackground(Color.white);
    setTitle("Dyna-stryfe");
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    addbackgound(this);
    getContentPane().setLayout(null);
    setResizable(false);
    setBackground(new Color(204, 204, 204));
    setVisible(true);

    b2 = new JButton("Play");
    b2.setBackground(Color.BLACK);
    b2.setFont(new Font("Showcard Gothic", Font.BOLD | Font.ITALIC, 11));
    b2.setForeground(Color.WHITE);
    b2.setBounds(450, 550, 132, 43);
    b2.addActionListener(this);
    add(b2);

    demo = new JLabel("<html><font color='white'>Demo version: 0.000011 </font></html>");
    demo.setBounds(870, 660, 300, 30);
    this.add(demo);

    accionarAgarreAutomatico = new JButton();
    accionarAgarreAutomatico.addActionListener(this);
  }