Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GUI layout question

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i have a interface which is seperated into different panels one of the particular panels has 3 buttons and a textArea. i am trying to have the button going vertical but when i try this the textArea goes below the buttons. i would like the display area to stay in the same position and my buttons to the side of them!!! how can i do this and is there and way i can make my buttons larger!!
any help would be great
 
Well the best advice I can give you would be that you may want to consider mastering the GridBagLayout. It is very powerfull, and flexable. Below are links to some tutorials you may want to check out:


Here is a tool that got be started on my way to GridBag Heaven:

You will be far happier in the long run if you can master this Complex layout manager.

Good Luck...

Rodney
 
you could just use another panel for the buttons, to allow a vertical arrangement, and then add the new panel and the textfield to another panel with a horizontal arrangement.
bruce21.jpg
 
Hey there,

I'm not sure what layout manager you are using but if you want a lot of control over the way components are orientated on your frame use setLayout(null);

Then use the toolkit to find the dimensions of your computers screen like so:

Toolkit tk = Toolkit.getDefaultTookit();
Dimension d = tk.getScreenSize();

Now that your computer program is storing the values for the screen you can use absolute positioning of components like so:

setSize(d.width/4,d.height/2);

You can define both location and dimensions of components using the above process and sometimes you will need to multiply by a fraction to get the degree of accuracy that you are looking for, e.g.: d.width*1/1345.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top