Example #1
0
    PanelSouth() {
      this.setLayout(new BorderLayout());
      label = new JLabel("      Натиснете бутона, чийто цвят е и вашето число");
      this.add(label, BorderLayout.NORTH);
      this.setBackground(Color.WHITE);
      label.setFont(newTextFont);

      button = new Button("BLUE", Color.BLUE);

      button1 = new Button("GREEN", Color.GREEN);

      button2 = new Button("PINK", Color.PINK);

      button3 = new Button("YELLOW", Color.YELLOW);

      JPanel pss = new JPanel();
      pss.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 10));
      pss.add(button);
      pss.add(button1);
      pss.add(button2);
      pss.add(button3);
      pss.setBackground(Color.WHITE);
      this.add(pss, BorderLayout.SOUTH);

      button.addActionListener(new buttonsListener());
      button1.addActionListener(new buttonsListener());
      button2.addActionListener(new buttonsListener());
      button3.addActionListener(new buttonsListener());
    }
Example #2
0
    PanelButtons() {
      this.setLayout(new BorderLayout());
      label = new JLabel("     Натиснете бутона, който съдържа вашето число");
      this.add(label, BorderLayout.NORTH);
      this.setBackground(Color.WHITE);
      label.setFont(newTextFont);

      buttonPan1 = new Button("      5     10     27     33      ", Color.RED);
      buttonPan2 = new Button("      18     3     6     8      ", Color.YELLOW);

      buttonPan3 = new Button("      2     15     11     19      ", Color.CYAN);

      buttonPan4 = new Button("      35     0     22     1      ", Color.ORANGE);

      JPanel pss = new JPanel();
      pss.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10));
      pss.add(buttonPan1);
      pss.add(buttonPan2);
      pss.add(buttonPan3);
      pss.add(buttonPan4);
      pss.setBackground(Color.WHITE);
      this.add(pss, BorderLayout.SOUTH);

      buttonPan1.addActionListener(new buttonsPanelListener());
      buttonPan2.addActionListener(new buttonsPanelListener());
      buttonPan3.addActionListener(new buttonsPanelListener());
      buttonPan4.addActionListener(new buttonsPanelListener());
    }