In the graphical interface programming, the button JButton need to lay out the position of the button, change the button size.
1) button Initialization
JButton button = new JButton ()
/* In the new JButton () bracket, you can add the character displayed by the button, etc.
JButton button = new JButton ("Jbuttonexample")
However, the size and position of the button cannot be initialized */
2) Determination of the position of the JButton button in the panel
Settings for the JButton size
--Because the JButton is a small device type, the general SetSize cannot be set to its size, so we usually use
Button.setpreferredsize (New Dimension (30,30));
(30,30) is the size of the button you want to set
3) Setting of the JButton position
When the panel JPanel or frame jframe determines the structure, the size and position of the JButton cannot be changed,
So to customize the location of the JButton, you should set the
Jpanel.setlayout (NULL);
Jframe.setlayout (NULL);
The location of the JButton is generally two methods
Jbutton.setlocation (x, y)
X is wide, Y is high
Jbutton.setbounds (x, Y,
JButton problems in Java interface programming