PDA

View Full Version : JAVA - Layout advice



serlex
March 9th, 2007, 07:18 PM
I'm trying to layout labels with text field in a panel. Java layout-managers are making me very angry

Any advice on how I should do this. Screenshot below

Ragazzo
March 9th, 2007, 07:28 PM
Here's an overview of the different layouts: http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html

I would use SpringLayout with the help of SpringUtilities.java (http://java.sun.com/docs/books/tutorial/uiswing/layout/examples/SpringUtilities.java) that is used in the examples.

Engnome
March 9th, 2007, 07:30 PM
What layout type are you using now? FlowLayout?

Try Grid or spring layout.

http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html

Edit: too slow :/

serlex
March 9th, 2007, 07:40 PM
EDIT: at that screenshot i was not using a layout,

OK, grid seem to be the easier option. Did a simple
setLayout(new GridLayout(0,2,30,30));

that gay me occured gaps :( . Spring looks very complicated, im gona have a go now

phossal
March 9th, 2007, 07:56 PM
For all but the most basic GUI's, I recommend netbeans. It's a pain to switch back and forth (as I do) between eclipse and netbeans, but GUI building is so much easier that it's a net improvement.

serlex
March 9th, 2007, 11:19 PM
ahh not netbeans :( thanks anyways