I cannot find anything on setBounds, what it is for, or what its function actually is. Could someone clear me up on this? Thanks so much!
The setBounds() method needs four arguments. The first two arguments are x and y coordinates of the top-left corner of the component, the third argument is the width of the component and the fourth argument is the height of the component.
setBounds() method needs four arguments. The first two arguments are the x and y coordinates of the upper left corner of the component, the third argument is the width of the component, and the fourth argument is the height of the component.
A border layout lays out a container, arranging and resizing its components to fit in five regions: north, south, east, west, and center. Each region may contain no more than one component, and is identified by a corresponding constant: NORTH , SOUTH , EAST , WEST , and CENTER .
The setVisible(true) method makes the frame appear on the screen. If you forget to do this, the frame object will exist as an object in memory, but no picture will appear on the screen.
You can use setBounds(x, y, width, height)
to specify the position and size of a GUI component if you set the layout
to null
. Then (x, y)
is the coordinate of the upper-left corner of that component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With