Results 1 to 2 of 2
  1. #1
    Rocketz is offline Member
    Join Date
    Feb 2011
    Posts
    10
    Rep Power
    0

    Default How Can I space out buttons?

    If I want to have a gap between two buttons in a flow layout how can I do that properly? Right now I'm using a JLabel of spaces but this seems like a terrible coding practice. Does anyone have a way to space things out using a legitimate method?

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

    Default

    I presume button you mean JButton - see Borders: How to Use Borders (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components) Depending upon how you wish the JButton to be displayed, you may wish to wrap it in a JPanel and set the border on the JPanel.

Similar Threads

  1. Space Invaders help!
    By Midge in forum New To Java
    Replies: 5
    Last Post: 03-04-2010, 04:38 PM
  2. add a space after 10 lines?
    By ukemasta in forum New To Java
    Replies: 10
    Last Post: 01-20-2010, 12:12 PM
  3. Replies: 0
    Last Post: 07-05-2009, 12:31 PM
  4. Blank space
    By sandy1028 in forum New To Java
    Replies: 1
    Last Post: 04-21-2009, 10:00 AM
  5. space between images !!
    By nhawlman in forum New To Java
    Replies: 1
    Last Post: 01-09-2009, 11:17 PM

Posting Permissions

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