I use swing to create my GUI. J has a JFrame containing one main JPanel, which in turn contains several JPanels, which in turn contain buttons.
I would like to set specific sizes for the mu and JPanels buttons. How it works? Should I set the sizes of my buttons, and then the size of the JPanel and JFrame will be set according to the size of the buttons? Or is he working in the opposite direction? I set the size for JPanel, and the size of the buttons will be set automatically?
ADDED:
I used fieldPanel.setPreferredSize(new Dimension(100,100));and did not affect the appearance of the window. Maybe because this panel is in the "middle of the hierarchy", it contains some buttons and is contained in other JPanels?
Roman source
share