Results 1 to 2 of 2
Thread: New Line in FlowLayout
- 12-07-2007, 05:57 AM #1Member
- Join Date
- Dec 2007
- Rep Power
New Line in FlowLayout
I have an assignment to make a form in an Applet. I have run into a seemingly minimal problem that has cost me about 2 hours. Is it possible to force a component in a FlowLayout to move to the next line down? I want 3 text fields on top, 3 in the middle, and 2 buttons on the bottom. Under the buttons, I need to output what was typed on individual lines. Is this possible?
- 12-07-2007, 05:49 PM #2
FlowLayout was not designed for this. Instead try something like this:
Make a separate JPanel for each row of three JTextFields. Use the default FlowLayout for these panels.
You now have three panels each containing three textFields.
Make another JPanel with a GridLayout with zero rows and one column (new Gridlayout(0,1))and add the three panels to it.
Set the layout for the Applet to BorderLayout and add this panel to the center section of the BorderLayout.
You can make up the lower output component(s) and add them to the south section of the BorderLayout.
This is referred to as using nested layouts.
- By mew in forum New To JavaReplies: 3Last Post: 12-14-2007, 06:24 PM
- By toad in forum New To JavaReplies: 2Last Post: 12-03-2007, 12:43 AM
- By kazitula in forum New To JavaReplies: 3Last Post: 11-21-2007, 10:27 PM
- By bluekswing in forum New To JavaReplies: 1Last Post: 10-02-2007, 12:19 AM
- By Rgfirefly24 in forum New To JavaReplies: 1Last Post: 08-06-2007, 08:40 AM