Why does the window display only the button3 button, moreover, on the whole screen? Code:

public class InterfaceCalq extends JFrame{ private JButton button0 = new JButton("Формулы куба"); private JButton button1 = new JButton("Формулы сферы"); private JButton button2 = new JButton("Формулы круга"); private JButton button3 = new JButton("Формулы цилиндра"); public InterfaceCalq(){ super("Калькулятор по формулам"); this.setBounds(200,200,300,450); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container container = this.getContentPane(); container.add(button0); container.add(button1); container.add(button2); container.add(button3); } /** * @param args the command line arguments */ public static void main(String[] args) { InterfaceCalq app = new InterfaceCalq(); app.setVisible(true); } } 

the question is how to make the buttons appear in a column and how to set them the size?

    2 answers 2

    The fact that button3 overlaps all the buttons that go to it, because your window is one solid field. You need to use the layout manager and already have buttons in it.

    More details:
    In English
    In Russian

      I have already asked a similar question and received a very good answer. Take a look . GridBagLayout is really a very good tool for positioning elements. The sooner you start using it, the more problems you can avoid.