Exemplo n.º 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);
  }
Exemplo n.º 2
0
  protected void setBgColor(Color bgColor) {
    setBackgroundColor(bgColor);

    panelForBtns.setBackground(Util.getBgColor());
    addButton.setBackground(Util.getBgColor());
    removeButton.setBackground(Util.getBgColor());
  }
  // -------------------------------------------------------------------
  public static void main(String[] args) {
    // Create the window
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(new Dimension(300, 100));
    frame.setTitle("A frame");
    frame.setLayout(new FlowLayout()); // This will be discuss in the next lesson

    // Create and add the first button
    JButton button1 = new JButton();
    button1.setText("I'm a button.");
    button1.setBackground(Color.BLUE);
    frame.add(button1);

    // Create and add the second button
    JButton button2 = new JButton();
    button2.setText("Click me!");
    button2.setBackground(Color.RED);
    frame.add(button2);

    // Reset the sizes of the buttons and window
    frame.pack();

    // Actually put the window on the screen and draw all its components
    frame.setVisible(true);
  }
Exemplo n.º 4
0
  /**
   * setButtonColors - helper method to constructor - will set the buttons to a certain color based
   * on which index (player) is now betting
   *
   * @param index - index of the current player
   */
  private void setButtonColors(int playerIndex) {
    Color c;
    switch (playerIndex) {
      case 0:
        c = Color.RED;
        break;
      case 1:
        c = Color.ORANGE;
        break;
      case 2:
        c = Color.GREEN;
        break;
      case 3:
        c = Color.BLUE;
        break;
      case 4:
        c = Color.GRAY;
        break;
      default:
        c = Color.WHITE; // to avoid compiler complaints
    }

    enterButton.setBackground(c);
    skipHandButton.setBackground(c);
  }
  public SurrenderUI() {
    setType(Type.UTILITY);

    ExitB = new JButton("Exit");
    ExitB.setFont(new Font("Tahoma", Font.BOLD, 12));
    ExitB.setBackground(new Color(255, 215, 0));
    ExitB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
            new HSmain();
          }
        });
    ExitB.setBounds(461, 427, 296, 60);

    setTitle("Surrendering a Pet");
    Container pane = getContentPane();
    getContentPane().setLayout(null);
    pane.add(ExitB);

    txtSurrender = new JTextField();
    txtSurrender.setEditable(false);
    txtSurrender.setForeground(new Color(0, 0, 0));
    txtSurrender.setBackground(new Color(255, 215, 0));
    txtSurrender.setBounds(10, 11, 764, 50);
    txtSurrender.setHorizontalAlignment(SwingConstants.CENTER);
    txtSurrender.setFont(new Font("Lucida Handwriting", Font.BOLD, 18));
    txtSurrender.setText("Surrendering a Pet");
    getContentPane().add(txtSurrender);
    txtSurrender.setColumns(10);

    BackB = new JButton("Back");
    BackB.setFont(new Font("Tahoma", Font.BOLD, 12));
    BackB.setBackground(new Color(255, 215, 0));
    BackB.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            new AnimalServiceUI();
            dispose();
          }
        });
    BackB.setBounds(26, 427, 320, 60);
    getContentPane().add(BackB);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(0, 72, 764, 329);
    getContentPane().add(scrollPane);

    JTextPane txtSurrenderInfo = new JTextPane();
    scrollPane.setViewportView(txtSurrenderInfo);
    txtSurrenderInfo.setForeground(new Color(0, 0, 0));
    txtSurrenderInfo.setEditable(false);
    txtSurrenderInfo.setFont(new Font("Times New Roman", Font.BOLD, 15));
    txtSurrenderInfo.setText(
        "\tThe Humane Society of Lamar cannot accept every animal brought to our shelter immediately. \r\nWe respect the difficult decision of owners to relinquish their pets, and the hard choices of those \r\ngood citizens who are trying to help a stray. We accept the surrender of pets as space allows. \r\nWe maintain a waiting list for all animals needing to be admitted to the shelter.\r\nAnimals are surrendered to our facility by appointment.\r\nWe admit at least 12 animals per week. We accept more animals as adoptions and space allow.\r\nNote that we cannot accept aggressive, sick or pregnant animals.\r\nPlease call 409-225-7981, and one of our adoption specialists will speak to you.\r\nAt times our waiting list will have up to 100 animals waiting for admission and it can take several weeks \r\nbefore we can admit your pet.\r\nPlease understand that our primary goal is to place as many animals in forever homes as possible, \r\ntherefore we must give every pet admitted to the shelter enough time to find a loving home. \r\nWe cannot guarantee placement of every animal admitted to the shelter.\r\n\t\r\n\tAdmission of any animal into the Humane Society of Lamar  is based on the animal\u2019s health, \r\nbehavior, and adoptability. When you bring your pets, please have:\r\n\r\n    *Any veterinary records\r\n    *Your pet\u2019s medications\r\n    *Special food or treats that your pet needs\r\n    *Your pet\u2019s bed, toys, leash and other belongings from home\r\n\r\nA staff member will evaluate the temperament of your pet. Once your pet has been screened, \r\nand the Humane Society of Lamar decides to accept your pet, we ask a donation to our shelter to be made. \r\nThis is not required, but will greatly help us care for your pet.");

    setSize(800, 553);
    setVisible(true);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }
  private void createRegisterForm() {
    JPanel registerFormContainer = new JPanel(new GridBagLayout());
    registerFormContainer.setBorder(new EmptyBorder(20, 20, 20, 20));

    int maxVisibleChar = 16;

    JLabel usernameLabel = new JLabel("Benutzername: ");
    registerFormContainer.add(usernameLabel, ConstraintsFactory.createConstraints(0, 0, 1, 1));

    usernameInput = new JTextField(maxVisibleChar);
    registerFormContainer.add(usernameInput, ConstraintsFactory.createConstraints(1, 0, 1, 1));

    JLabel emailLabel = new JLabel("E-Mail: ");
    registerFormContainer.add(emailLabel, ConstraintsFactory.createConstraints(0, 1, 1, 1));

    emailInput = new JTextField(maxVisibleChar);
    registerFormContainer.add(emailInput, ConstraintsFactory.createConstraints(1, 1, 1, 1));

    JLabel passwordLabel = new JLabel("Passwort: ");
    registerFormContainer.add(passwordLabel, ConstraintsFactory.createConstraints(0, 2, 1, 1));

    passwordInput = new JPasswordField(maxVisibleChar);
    registerFormContainer.add(passwordInput, ConstraintsFactory.createConstraints(1, 2, 1, 1));

    JLabel repasswordLabel = new JLabel("Passwort (nochmals): ");
    registerFormContainer.add(repasswordLabel, ConstraintsFactory.createConstraints(0, 3, 1, 1));

    repasswordInput = new JPasswordField(maxVisibleChar);
    registerFormContainer.add(repasswordInput, ConstraintsFactory.createConstraints(1, 3, 1, 1));

    registerButton = new JButton("Registrieren");
    registerButton.setBackground(Color.WHITE);
    registerFormContainer.add(
        registerButton,
        ConstraintsFactory.createConstraints(
            0,
            4,
            1,
            1,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(10, 10, 10, 10)));

    cancelButton = new JButton("Abbrechen");
    cancelButton.setBackground(Color.WHITE);
    registerFormContainer.add(
        cancelButton,
        ConstraintsFactory.createConstraints(
            1,
            4,
            1,
            1,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(10, 10, 10, 10)));

    this.add(registerFormContainer, BorderLayout.CENTER);
  }
Exemplo n.º 7
0
  // Constructor
  public DeleteArchiveFrame(AmazonGlacierClient client, String vaultName, int region) {
    super("Delete Archive");

    int width = 200;
    int height = 170;

    Color wc = Color.WHITE;

    deleteClient = client;
    deleteVault = vaultName;

    JLabel label1 =
        new JLabel("ArchiveID to Delete from " + Endpoint.getTitleByIndex(region) + ":");
    jtfDeleteField = new JTextField(100);
    jbtDelete = new JButton("Delete");
    jbtBack = new JButton("Back");

    JPanel p1 = new JPanel();
    p1.setLayout(new FlowLayout());
    p1.add(label1);
    p1.setBackground(wc);

    JPanel p2 = new JPanel();
    p2.setLayout(new FlowLayout());
    p2.add(jtfDeleteField);
    jtfDeleteField.addMouseListener(new ContextMenuMouseListener());
    jtfDeleteField.setFocusable(true);
    p2.setBackground(wc);

    JPanel p3 = new JPanel();
    p3.setLayout(new FlowLayout());
    p3.add(jbtDelete);
    jbtDelete.addActionListener(this);
    jbtDelete.setBackground(wc);
    p3.add(jbtBack);
    jbtBack.addActionListener(this);
    jbtBack.setBackground(wc);
    p3.setBackground(wc);

    JPanel p4 = new JPanel();
    p4.setLayout(new BorderLayout());
    p4.setBackground(wc);
    p4.add(p1, BorderLayout.NORTH);
    p4.add(p2, BorderLayout.CENTER);
    p4.add(p3, BorderLayout.SOUTH);

    setContentPane(p4);

    // Prepare for display
    pack();
    if (width < getWidth()) // prevent setting width too small
    width = getWidth();
    if (height < getHeight()) // prevent setting height too small
    height = getHeight();
    centerOnScreen(width, height);
    jtfDeleteField.setText("");
    jtfDeleteField.requestFocus();
  }
Exemplo n.º 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();
  }
Exemplo n.º 9
0
 public void mouseExited(MouseEvent e) {
   JButton jbutton = (JButton) e.getSource();
   int comm = Integer.parseInt(jbutton.getActionCommand());
   int today = getNowCalendar().get(Calendar.DAY_OF_MONTH);
   if (comm == today) {
     jbutton.setBackground(todayBtnColor);
   } else {
     jbutton.setBackground(palletTableColor);
   }
 }
Exemplo n.º 10
0
 private void jbInit() throws Exception {
   this.getContentPane().setLayout(null);
   Bienvenue.setFont(new java.awt.Font("Garamond", 1, 24));
   Bienvenue.setForeground(SystemColor.textHighlight);
   Bienvenue.setRequestFocusEnabled(true);
   Bienvenue.setVerifyInputWhenFocusTarget(true);
   Bienvenue.setText("Bienvenue dans JChat");
   Bienvenue.setBounds(new Rectangle(125, 28, 305, 44));
   Pseudo_L.setFont(new java.awt.Font("Dialog", 1, 14));
   Pseudo_L.setText("Pseudonyme :");
   Pseudo_L.setBounds(new Rectangle(75, 94, 128, 28));
   nom.setText("");
   nom.setBounds(new Rectangle(229, 95, 108, 24));
   pwd.setText("");
   pwd.setBounds(new Rectangle(230, 135, 108, 25));
   pwd_L.setFont(new java.awt.Font("Dialog", 1, 14));
   pwd_L.setText("Mot de passe :");
   pwd_L.setBounds(new Rectangle(76, 133, 122, 31));
   gestionnaire_B gestionnaire = new gestionnaire_B();
   Connect.addActionListener(gestionnaire);
   Connect.setBackground(new Color(239, 240, 234));
   Connect.setBounds(new Rectangle(281, 251, 142, 30));
   Connect.setText("Connexion");
   Connect.setIcon(new ImageIcon(image_c));
   Annuler.addActionListener(gestionnaire);
   Annuler.setBackground(new Color(239, 240, 234));
   Annuler.setBounds(new Rectangle(104, 252, 140, 29));
   Annuler.setText("Annuler");
   Annuler.setIcon(new ImageIcon(image_d));
   this.getContentPane().setBackground(new Color(239, 240, 234));
   this.setForeground(new Color(239, 240, 234));
   this.setTitle("Interface de connexion des clients au serveur de chat");
   jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
   jLabel1.setText("Adresse du serveur :");
   jLabel1.setBounds(new Rectangle(75, 176, 156, 26));
   jTextField1.setBounds(new Rectangle(230, 176, 108, 25));
   Icon siegle = new ImageIcon(image);
   siegle_L = new JLabel("", siegle, SwingConstants.LEFT);
   siegle_L.setBounds(new Rectangle(0, 1, 76, 105));
   this.getContentPane().add(jLabel1, null);
   this.getContentPane().add(pwd_L, null);
   this.getContentPane().add(Pseudo_L, null);
   this.getContentPane().add(jTextField1, null);
   this.getContentPane().add(nom, null);
   this.getContentPane().add(pwd, null);
   this.getContentPane().add(Bienvenue, null);
   this.getContentPane().add(Connect, null);
   this.getContentPane().add(Annuler, null);
   this.getContentPane().add(siegle_L, null);
   this.setSize(new Dimension(439, 321));
   this.setResizable(false);
   this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   this.setVisible(true);
 }
Exemplo n.º 11
0
 public void updateKeyboardUI() {
   if (Skin.VIETNAMESE_KEY.isEnabled()) {
     chkVietnamese.setText(" V ");
     chkVietnamese.setBackground(Color.yellow);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.red, 1));
   } else {
     chkVietnamese.setText(" E ");
     chkVietnamese.setBackground(Color.cyan);
     chkVietnamese.setBorder(BorderFactory.createLineBorder(Color.blue, 1));
   }
 }
Exemplo n.º 12
0
  // Test routine.
  public static void main(String[] args) {
    // Create a button with the label "Jackpot".
    JButton button = new RoundButton("Jackpot");
    button.setBackground(Color.green);

    // Create a frame in which to show the button.
    JFrame frame = new JFrame();
    frame.getContentPane().setBackground(Color.yellow);
    frame.getContentPane().add(button);
    frame.getContentPane().setLayout(new FlowLayout());
    frame.setSize(150, 150);
    frame.setVisible(true);
  }
 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());
     laLigneSelectionnee = row;
   }
   label = (value == null) ? "" : value.toString();
   button.setText(label);
   isPushed = true;
   return button;
 }
Exemplo n.º 14
0
 @Override
 public void mouseExited(MouseEvent me) {
   if (me.getSource() == jbtnListar) {
     jbtnListar.setBackground(new Color(0, 154, 225));
   }
   if (me.getSource() == jbtnBuscar) {
     jbtnBuscar.setBackground(new Color(0, 154, 225));
   }
   if (me.getSource() == jbtnActualizar) {
     jbtnActualizar.setBackground(new Color(0, 154, 225));
   }
   if (me.getSource() == jbtnLimpiar) {
     jbtnLimpiar.setBackground(new Color(0, 154, 225));
   }
 }
    protected void initComponents() {
      int border = 2;
      this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
      this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

      // Description label
      JPanel descriptionPanel = new JPanel(new GridLayout(0, 1, 0, 0));
      descriptionPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border));
      String text = thread.getRetrievable().getName();
      text = text.length() > 40 ? text.substring(0, 37) + "..." : text;
      descriptionLabel = new JLabel(text);
      descriptionPanel.add(descriptionLabel);
      this.add(descriptionPanel);

      // Progrees and cancel button
      JPanel progressPanel = new JPanel();
      progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.X_AXIS));
      progressPanel.setBorder(BorderFactory.createEmptyBorder(border, border, border, border));
      progressBar = new JProgressBar(0, 100);
      progressBar.setPreferredSize(new Dimension(100, 16));
      progressPanel.add(progressBar);
      progressPanel.add(Box.createHorizontalStrut(8));
      cancelButton = new JButton("Cancel");
      cancelButton.setBackground(Color.RED);
      cancelButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              cancelButtonActionPerformed(event);
            }
          });
      progressPanel.add(cancelButton);
      this.add(progressPanel);
    }
Exemplo n.º 16
0
  public TestPanels() {
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(4, 3)); /*GridLayout的构造方法*/
    JButton jb = null;
    for (int i = 1; i <= 9; i++) {
      jb = new JButton("" + i);
      /*创建字体*/
      Font ft = new Font("Microsoft YaHei UI Light", Font.BOLD + Font.ITALIC, 20 + i);
      /*设置JButton的字体*/
      jb.setFont(ft);
      /*设置JButton的前景色和背景色
       *这两个方法是Component类的方法
       **/
      jb.setBackground(Color.BLACK);
      jb.setForeground(Color.WHITE);
      p1.add(jb);
    }
    p1.add(new JButton("" + 0));
    p1.add(new JButton("Start"));
    p1.add(new JButton("Stop"));

    JPanel p2 = new JPanel();
    p2.setLayout(new BorderLayout());
    p2.add(new JTextField("Time to be displayed here."), BorderLayout.NORTH);
    p2.add(p1, BorderLayout.CENTER);

    setLayout(new BorderLayout());
    add(new JButton("Food to be placed here."), BorderLayout.WEST);
    add(p2, BorderLayout.CENTER);
  }
Exemplo n.º 17
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);
  }
Exemplo n.º 18
0
  /** Method to create link annotation GUI. */
  private void createGUI() {

    // Create and setup an Appearance panel
    setBorder(
        new TitledBorder(
            new EtchedBorder(EtchedBorder.LOWERED),
            messageBundle.getString("viewer.utilityPane.annotation.ink.appearance.title"),
            TitledBorder.LEFT,
            TitledBorder.DEFAULT_POSITION));
    // Line thickness
    lineThicknessBox = new JComboBox(LINE_THICKNESS_LIST);
    lineThicknessBox.setSelectedIndex(DEFAULT_LINE_THICKNESS);
    lineThicknessBox.addItemListener(this);
    add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.lineThickness")));
    add(lineThicknessBox);
    // Line style
    lineStyleBox = new JComboBox(LINE_STYLE_LIST);
    lineStyleBox.setSelectedIndex(DEFAULT_LINE_STYLE);
    lineStyleBox.addItemListener(this);
    add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.lineStyle")));
    add(lineStyleBox);
    // border colour
    colorBorderButton = new JButton();
    colorBorderButton.addActionListener(this);
    colorBorderButton.setOpaque(true);
    colorBorderButton.setBackground(DEFAULT_BORDER_COLOR);
    add(new JLabel(messageBundle.getString("viewer.utilityPane.annotation.ink.colorBorderLabel")));
    add(colorBorderButton);
  }
Exemplo n.º 19
0
  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();
  }
Exemplo n.º 20
0
  public JButton ButtonProperties(JButton button, String buttonText) {

    button.setFont(componentFont);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setBackground(themeColor1);
    button.setForeground(themeColor4);
    button.setVerticalTextPosition(SwingConstants.BOTTOM);
    button.setHorizontalTextPosition(SwingConstants.CENTER);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {

            button.setBackground(themeColor2);
            button.setForeground(Color.BLACK);
            button.setText(buttonText);
          }

          @Override
          public void mouseExited(MouseEvent e) {

            button.setBackground(themeColor1);
            button.setForeground(themeColor4);
            button.setText("");
          }
        });
    return button;
  }
Exemplo n.º 21
0
  public JButton ButtonProperties(JButton button) {

    button.setFont(componentFont);
    button.setBorderPainted(false);
    button.setFocusPainted(false);
    button.setBackground(themeColor1);
    button.setForeground(themeColor4);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {

            button.setBackground(themeColor2);
            button.setForeground(Color.BLACK);
          }

          @Override
          public void mouseExited(MouseEvent e) {

            button.setBackground(themeColor1);
            button.setForeground(themeColor4);
          }
        });
    return button;
  }
Exemplo n.º 22
0
  Jf() {

    j.setBounds(500, 40, 500, 500);
    j.setVisible(true);
    j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    j.setLayout(null);
    ImageIcon image = new ImageIcon("im1.jpg");
    JLabel l = new JLabel(image);
    int m = image.getIconWidth();
    int m1 = image.getIconHeight();
    j.setResizable(false); // frame resize nahi hoga	
    l.setBounds(0, 0, m, m1);
    j.add(l);
    l.add(linfo);
    l.add(lid);
    l.add(fid);
    l.add(lpass);
    l.add(fpass);
    fpass.setEchoChar('*');

    l.add(blogin);
    l.add(bnewaccount);
    l.add(bforget);

    ImageIcon image1 = new ImageIcon("logo1.png");
    JLabel limage = new JLabel(image1);
    l.add(limage);
    limage.setBounds(10, 50, 190, 130);

    Font f = new Font("ALGERIAN", Font.BOLD, 20);
    linfo.setFont(f);
    linfo.setBounds(40, 10, 420, 30);
    lid.setBounds(210, 50, 70, 30);
    fid.setBounds(290, 50, 150, 30);
    lpass.setBounds(210, 90, 70, 30);
    fpass.setBounds(290, 90, 150, 30);
    blogin.setBounds(210, 130, 100, 50);
    bnewaccount.setBounds(320, 130, 160, 20);
    bforget.setBounds(320, 160, 160, 20);
    blogin.setBackground(Color.green);
    bnewaccount.setBackground(Color.cyan);
    bforget.setBackground(Color.pink);

    blogin.addActionListener(new Login());
    bnewaccount.addActionListener(new Account());
    bforget.addActionListener(new Forget());
  }
Exemplo n.º 23
0
 /**
  * Modifie le compteur des tables sélectionnées.
  *
  * @param n Le nombre de tables sélectionnées.
  * @return true Si la sélection peut se faire.
  */
 public boolean setTableCounter(int n) {
   this.tableCounter = n;
   try {
     // Si on a renté un prix et que l'on a sélectionner des tables
     if (Float.parseFloat(payTextField.getText()) >= 0 && tableCounter > 0) {
       valider.setEnabled(true); // On active le bouton valider
       valider.setBackground(Color.GREEN);
     } else {
       valider.setEnabled(false); // On désactive le bouton valider
       valider.setBackground(Color.GRAY);
     }
   } catch (NumberFormatException e) { // Si le prix est invalide désactive le bouton valider
     valider.setEnabled(false);
     valider.setBackground(Color.GRAY);
   }
   return true;
 }
 private JButton addButton(String name, Color color) {
   JButton button = new JButton(name);
   button.setBackground(color);
   // button.setIcon(makeIcon(color, 50, 20));
   button.setAction(setColorAction);
   add(button);
   return button;
 }
Exemplo n.º 25
0
  public void initComponents() {
    /** ******************** The main container *************************** */
    Container container = this.getContentPane();
    container.setLayout(new BorderLayout());
    container.setBackground(Color.black);
    this.setSize(650, 600);
    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {}
        });

    /** ************************* MAIN PANEL ******************************* */
    mainPanel = new JPanel();
    // If put to False: we see the container's background
    mainPanel.setOpaque(false);
    mainPanel.setLayout(new BorderLayout());
    container.add(mainPanel, BorderLayout.CENTER);

    allmessagesTextArea = new TextArea();
    allmessagesTextArea.setEditable(false);
    allmessagesTextArea.setFont(new Font("Dialog", 1, 12));
    allmessagesTextArea.setForeground(Color.black);
    allmessagesTextArea.append("Select a session in the list to view its messages");
    mainPanel.add(allmessagesTextArea, BorderLayout.CENTER);

    sessionsList = new List();
    sessionsList.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            showMessages(e);
          }
        });
    sessionsList.setForeground(Color.black);
    sessionsList.setFont(new Font("Dialog", 1, 14));
    mainPanel.add(sessionsList, BorderLayout.WEST);

    okButton = new JButton("  OK  ");
    okButton.setToolTipText("Returns to the main frame");
    okButton.setFont(new Font("Dialog", 1, 16));
    okButton.setFocusPainted(false);
    okButton.setBackground(Color.lightGray);
    okButton.setBorder(new BevelBorder(BevelBorder.RAISED));
    okButton.setVerticalAlignment(SwingConstants.CENTER);
    okButton.setHorizontalAlignment(SwingConstants.CENTER);
    container.add(okButton, BorderLayout.SOUTH);
    okButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent evt) {
            setVisible(false);
          }
        });
  }
Exemplo n.º 26
0
  Main() {
    img = new ImageIcon("Indian-Railway-Network.jpg");
    imgL = new JLabel(img);
    imgL.setBounds(0, 0, 1300, 1000);
    f = new JFrame("Main");
    f.getContentPane().setLayout(null);
    f.getContentPane().setBackground(Color.green);
    b1 = new JButton("Reservation Form");
    b1.addActionListener(this);
    b1.setBounds(150, 390, 210, 60);
    b2 = new JButton("PNR-enquiry");
    b2.addActionListener(this);
    b2.setBounds(150, 490, 210, 60);
    b3 = new JButton("Cancellation Form");
    b3.addActionListener(this);
    b3.setBounds(580, 390, 210, 60);
    b4 = new JButton("Exit");
    b4.addActionListener(this);
    b4.setBounds(580, 490, 210, 60);

    b1.setBackground(new Color(100, 200, 0));
    b1.setForeground(new Color(255, 255, 255));
    b2.setBackground(new Color(100, 200, 0));
    b2.setForeground(new Color(255, 255, 255));
    b3.setBackground(new Color(100, 200, 0));
    b3.setForeground(new Color(255, 255, 255));
    b4.setBackground(new Color(100, 200, 0));
    b4.setForeground(new Color(255, 255, 255));

    b1.setMnemonic('R');
    b2.setMnemonic('P');
    b3.setMnemonic('C');
    b4.setMnemonic('E');

    f.getContentPane().add(b1);
    f.getContentPane().add(b2);
    f.getContentPane().add(b3);
    f.getContentPane().add(b4);
    f.getContentPane().add(imgL);
    f.setSize(1300, 1000);
    f.setVisible(true);
  }
Exemplo n.º 27
0
  public Abschluss(String wahl, Sudoku s, Sudoku2 s2) {
    super("Sudoku-Abschluss");
    this.setSize(270, 135);
    this.setLocation(250, 300);
    this.setLayout(null);
    this.setAlwaysOnTop(true);
    this.setResizable(false);
    this.setUndecorated(true);
    if (s == null) this.setLocationRelativeTo(s2);
    else this.setLocationRelativeTo(s);

    su = s;
    su2 = s2;
    w = wahl;

    ImageIcon icon = new ImageIcon("files/minigames/Sudoku/beispiel2.jpg");
    icon.setImage(icon.getImage().getScaledInstance(290, 135, Image.SCALE_DEFAULT));

    lab = new JLabel(icon);
    lab.setSize(270, 135);
    lab.setLocation(0, 0);
    this.add(lab);

    text = new JLabel();
    text.setSize(250, 20);
    text.setLocation(10, 10);
    text.setForeground(Color.white);
    text.setHorizontalAlignment(0);
    lab.add(text);

    text2 = new JLabel();
    text2.setSize(270, 20);
    text2.setLocation(10, 30);
    text2.setForeground(Color.white);
    lab.add(text2);

    ok = new JButton("OK");
    ok.setSize(90, 30);
    ok.setLocation(80, 50);
    ok.setBorderPainted(false);
    ok.setBackground(Color.lightGray);
    ok.setForeground(Color.lightGray);
    ok.setOpaque(false);
    ok.setFont(new Font("Arial Black", 4, 20));
    ok.setContentAreaFilled(false);
    ok.setFocusPainted(false);
    ok.addActionListener(this);
    ok.addMouseListener(this);
    lab.add(ok);

    textWahl(wahl);

    this.setVisible(true);
  }
Exemplo n.º 28
0
  /*Creates the East section of the mancala board. Contains Collection Pit*/
  private JPanel eastBoardPanel() {
    JPanel eastPanel = new JPanel();
    eastPanel.setOpaque(false);
    eastPanel.setPreferredSize(new Dimension(150, 600));

    b6 = new JButton(String.valueOf(game.board.getPitAt(6).getCount()));
    b6.setPreferredSize(new Dimension(100, 330));
    b6.setFont(new Font("Belta Regular", Font.BOLD, 32));
    b6.setBackground(new Color(214, 162, 173));
    eastPanel.add(b6);
    return eastPanel;
  }
 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());
   }
   String[] jakasnazwa = value.toString().split(" ");
   label = (value == null) ? "" : jakasnazwa[0];
   button.setText(label);
   button.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           main.sendMessage(
               new JSONObject().put("cmd", "connectToGame").put("identifier", jakasnazwa[1]));
           main.getMainPanel().requestFocus();
         }
       });
   return button;
 }
    /** Constructor. */
    public FileChooserCellEditor() {
      super(new JTextField());
      setClickCountToStart(CLICK_COUNT_TO_START);

      // Using a JButton as the editor component
      button = new JButton();
      button.setBackground(Color.white);
      button.setFont(button.getFont().deriveFont(Font.PLAIN));
      button.setBorder(null);

      // Dialog which will do the actual editing
      fileChooser = new JFileChooser();
      fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }