Results 1 to 3 of 3

Thread: Best Layout

  1. #1
    deathbutton1 is offline Null Pointer Exception
    Join Date
    Apr 2012
    Location
    United States
    Posts
    2
    Rep Power
    0

    Default Best Layout

    I am wanting to make a JApplet with a menu bar and a JPanel like this

    -------------------------------------------
    Menu Bar |
    ------------------------------------------
    JPanel |
    |
    |
    |
    |
    |
    -------------------------------------------

    But all I get is something like:

    -----------------------------------
    Menu Bar |
    |
    |
    |
    |
    -----------------------------------
    JPanel |
    |
    |
    |
    |
    ------------------------------------

    What is the best layout manager to do the first option? I have access to NetBean's Visual Swing builder, but Netbeans does not allow me to edit the code, making me want to do this manually. Any help on how I should do this. It is a simple thing that is driving me up the wall.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Best Layout

    You can tell NetBeans to change the layout to something more reasonable if need be. Best for your situation is to use a BorderLayout and place your JPanel BorderLayout.CENTER and the JMenuBar BorderLayout.PAGE_START.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,305
    Rep Power
    20

    Default Re: Best Layout

    Java Code:
    JApplet#setJMenuBar(...)
    db
    Last edited by DarrylBurke; 04-08-2012 at 05:48 AM.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Layout help
    By mafyou in forum AWT / Swing
    Replies: 3
    Last Post: 03-28-2012, 07:14 AM
  2. Grid Layout change layout alignment of control s
    By rellicott in forum SWT / JFace
    Replies: 1
    Last Post: 02-13-2012, 05:11 PM
  3. Help trying to set GUI layout
    By JLSHARP92 in forum AWT / Swing
    Replies: 5
    Last Post: 01-24-2012, 06:59 PM
  4. Which Layout should I use?
    By Josep_16 in forum Java Applets
    Replies: 2
    Last Post: 08-17-2011, 03:42 PM
  5. Edit layout Layout please help me
    By manhtungtnk28@gmail.com in forum New To Java
    Replies: 4
    Last Post: 11-23-2009, 08:41 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
  •