• Post Reply Bookmark Topic Watch Topic
  • New Topic

Resizing a JButton in GridLayout

 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Have a JPanel of GridLayout with 0 rows & 1 column so now If I add a JButton to it the Button is taking the whole size of the JPanel Can I reduce the Size of it.
 
Darryl Burke
Bartender
Posts: 5152
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but not with a GridLayout. What made you choose a layout manager that is so unsuited to your requirement?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Put the button inside a JPanel and then add the JPanel to the GridLayout
2) Use GridBagLayout
 
Rohit Kedia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir I am trying to Add A JPanel which has Some Components in it But it is not working at all
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!