954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

JButtons Locations

I'm trying to learn java.
Now I want to test the buttons, but I don't understand the part of the layout.
Can't I just write button1.setLocation(50,50);
or someting like that ???

Thanks in advance.

superjj
Light Poster
32 posts since Nov 2010
Reputation Points: 10
Solved Threads: 1
 

Yes, it's possible to set the exact pixel position and size of every component in your GUI, but that's not a recommended solution.
Java has a choice of layout managers to help you position and size your components so that they still look right even if the system font changes, or you move from Windows to Linux, or the user simply re-sizes the window. Here's where to start:
http://download.oracle.com/javase/tutorial/uiswing/layout/using.html

JamesCherrill
Posting Genius
Moderator
6,371 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: