Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Simple JToolBar Problem

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple JToolBar Problem

    Basically I have created a JPanel with one JToolBar at the top (BorderLayout.NORTH), then I made a sidebar on the right(BorderLayout.EAST). Although when I add buttons to said sidebar, they are arranged horizontally(see attached, ignore the angry birds theme :p), when i need them to display vertically. I'm no expert with Swing, as you can probably tell..
    Attached Images Attached Images


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,298
    My Mood
    Hungover
    Thanks
    142
    Thanked 620 Times in 531 Posts

    Default Re: Simple JToolBar Problem

    If you want help, you'll have to provide an SSCCE (not your whole program, but something we can copy and paste to run) that demonstrates exactly what you're talking about. Otherwise we're just guessing.

    Recommended reading: How to Use Tool Bars (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Simple JToolBar Problem

    Apologies, messing around with GridLayout, I managed to fix my problem. Was a simple one line:

    toolbar2.setLayout(new GridLayout(3,1));

Similar Threads

  1. Very simple GUI problem
    By clydefrog in forum AWT / Java Swing
    Replies: 8
    Last Post: March 20th, 2012, 10:37 AM
  2. please help, simple problem
    By grandmst in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 13th, 2011, 05:26 PM
  3. Replies: 33
    Last Post: May 25th, 2011, 06:59 AM
  4. Very simple problem...PLEASE HELP!
    By dungeondragon in forum What's Wrong With My Code?
    Replies: 4
    Last Post: March 1st, 2011, 06:19 AM
  5. Simple problem...
    By _lithium_ in forum What's Wrong With My Code?
    Replies: 9
    Last Post: February 5th, 2011, 11:02 PM