Results 1 to 3 of 3
  1. #1
    andyliteral is offline Member
    Join Date
    Mar 2011
    Posts
    1
    Rep Power
    0

    Default how to fix the size of buttons?

    when i put buttons inside a frame with GridLayout, the buttons are always resized according to the size of the frame, which i don't want, so is there a way to make the size of the button fixed?
    Last edited by andyliteral; 03-23-2011 at 03:08 PM.

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

    Default

    Your post doesn't give us enough useful information to allow us to give you a helpful answer. Please read the link in my signature below on "how to ask smart questions" as it will give several useful suggestions on what we need in order to be able to help you out.

    Much luck.

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,234
    Rep Power
    7

    Default

    That is the functionality of the GridLayout. One way is to use another layout manager like a FlowLayout.

    Or another option is to add the panel with your buttons to another panel, then add this second panel to the frame. By default the second panel uses a FlowLayout which will respect the size of the panel using the GridLayout.

    You need to read up on Layout Managers to understand what each does and to learn how to use them together.

Similar Threads

  1. Make all buttons the same size
    By Matthew1246 in forum AWT / Swing
    Replies: 3
    Last Post: 03-22-2011, 01:22 PM
  2. Help with Buttons
    By wld4ubabay in forum New To Java
    Replies: 20
    Last Post: 05-17-2010, 08:13 AM
  3. Setting frame size to the size of an image
    By Yoruichi in forum AWT / Swing
    Replies: 5
    Last Post: 04-22-2009, 04:37 PM
  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

Posting Permissions

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