Hi everybody!
Help me plz to figure out obe little thing. so imagine little window with 4 buttons and a JLable. I want to ask how to add JLable to the panel and not give it a Grid Layout. I mean that I want my JLable be under 4 buttons. But it should not be in the table.
******************************
* Button 1 * Button 2 *
* * *
******************************
* Button 3 * Button 4 *
* * *
******************************
* Here should be my JLable *
* *
******************************
public class ButtonPanel extends JPanel{
private ButtonsModel bm;
private JLabel label;
public ButtonPanel() {
GridLayout gl = new GridLayout(2,2);
this.setLayout(gl);
bm = new ButtonsModel();
JButton button_1 = new JButton("1");
JButton button_2 = new JButton("2");
JButton button_3 = new JButton("3");
JButton button_4 = new JButton("4");
label = new JLabel("" + bm.getCurrentButton());
this.add(button_1);
this.add(button_2);
this.add(button_3);
this.add(button_4);
this.add(label);
Listener listener = new Listener();
button_1.addActionListener(listener);
button_2.addActionListener(listener);
button_3.addActionListener(listener);
button_4.addActionListener(listener);
}