Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.
Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg
by albertkao » Sat Jan 01, 2011 2:54 pm
How to put one JLabel & one JTextField per line with the FlowLayout Manager?
Nowall JLabel & JTextField components are added on the same line with FlowLayout Manager.
i.e. the red line insertion cursor stay on the same line but do not move to the next line even though I press the <Enter> key.
-
albertkao
-
- Posts: 2
- Joined: Sat Jan 01, 2011 2:30 pm
by Eric Clayberg » Sat Jan 01, 2011 6:37 pm
That isn't how FlowLayout works. FlowLayout lays out widgets left to right until the line is filled and then it wraps to the next line.
There is no concept of an <Enter> key to end a line early and jump to the next line.
If you want a grid, I would suggest that you use GridLayout or GridBagLayout (or even better JGFL or MigLayout).
-
Eric Clayberg
- Moderator
-
- Posts: 4503
- Joined: Tue Sep 30, 2003 6:39 am
- Location: Boston, MA USA
-
Return to Swing Designer
Who is online
Users browsing this forum: No registered users and 1 guest