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);
		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());
		Listener listener = new Listener();

Create two panels, one with the four buttons and a separate panel with the label. Then add both panels to your main panel. This allows you to use different layout managers in each panel to get the exact result you want.

Alternatively, you could use a GridBagLayout to do the whole thing, but the learning curve is quite steep.

great minds thinks alike !!!, I didn't saw your answer :-)

1) basic stuff (valid for part of programing languages) is use nested layout

- put 4 JButtons to the JPanel layed by GridLayout,

- put this JPanel put to the JFrame myFrame.add(myFirstPanel, BorderLayout.CENTER)

- put JLabel to the another JPanel (without declaring for LayourManager is there FlowLayout and JLabel will be centered in the JPanel)

- put this second JPanel to the JFrame myFrame.add(my2ndPanel, BorderLayout.SOUTH)

2) by using GridBagLayout or MigLayout

This question has already been answered. Start a new discussion instead.