Results 1 to 2 of 2
  1. #1
    chris12295 is offline Member
    Join Date
    Dec 2007
    Posts
    1
    Rep Power
    0

    Default 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?

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    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.

Similar Threads

  1. New line character
    By mew in forum New To Java
    Replies: 3
    Last Post: 12-14-2007, 06:24 PM
  2. Help Using FlowLayout Manager
    By toad in forum New To Java
    Replies: 2
    Last Post: 12-03-2007, 12:43 AM
  3. line number
    By kazitula in forum New To Java
    Replies: 3
    Last Post: 11-21-2007, 10:27 PM
  4. Reading in data from file line by line
    By bluekswing in forum New To Java
    Replies: 1
    Last Post: 10-02-2007, 12:19 AM
  5. Help with Drawing a line
    By Rgfirefly24 in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 08:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •