Results 1 to 5 of 5
  1. #1
    Taylor91 is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default Set Buttons on top of each other

    Set Buttons on top of each other-buttons.png

    I have four buttons for a game, and this is what they currently look like. However, I want the 'up' button to be above the 'down' button, with a space in between.

    I'm using boxLayout right now, and have tried adding vertical strut and vertical glue, but to no avail. Any ideas?

    I also tried using border Layout, but I could not get the buttons to 'squish' to the center of the panel.

    Thanks

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default Re: Set Buttons on top of each other

    You should probably explain more as to how you wish to layout the buttons...there are quite a few Layouts which will do a bunch of versions of what I can imagine - for instance, a nested BoxLayout - the outer container being along the horizontal axis, with 3 inner Layouts placed on the vertical and packing using Vertical Glue's (left in first, down and up in the middle, and right in the last)

  3. #3
    Taylor91 is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default Re: Set Buttons on top of each other

    Set Buttons on top of each other-buttons2.png

    This is what I'd like it to look like.

    Sorry for the poor explanation.

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

    Default Re: Set Buttons on top of each other

    GridLayout(3, 3) where you add empty JLabels alternating with your JButtons.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,197
    Rep Power
    19

    Default Re: Set Buttons on top of each other

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Cannot click on the buttons
    By pabloma2002 in forum CLDC and MIDP
    Replies: 0
    Last Post: 01-24-2011, 04:35 PM
  2. Help with Buttons
    By wld4ubabay in forum New To Java
    Replies: 20
    Last Post: 05-17-2010, 08:13 AM
  3. Buttons and Method
    By imagiro1 in forum New To Java
    Replies: 2
    Last Post: 05-03-2010, 04:09 AM
  4. Where To Get Pop Up Buttons
    By hitmen in forum AWT / Swing
    Replies: 7
    Last Post: 03-26-2009, 04:05 AM
  5. How to use SWT Buttons
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-11-2008, 04:44 PM

Tags for this Thread

Posting Permissions

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