What is setBounds and how do I use it?

JeremyF picture JeremyF · Oct 17, 2013 · Viewed 222k times · Source

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!

Answer

tianz picture tianz · Oct 17, 2013

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.