-
JPanel with GridBagLayout resizing problem
I created a JFrame that uses a GridBagLayout, with three JPanels inside. In one panel, which happens to be the largest, is a GridLayout of JButtons, in a 6x6 formation. The text for each of the JButtons changes periodically, and sometimes when it does change, there is a small change in the size of the whole Panel. My problem is that I can't find a way to keep the size of this JPanel from changing. I'm guessing it has something to do with the GridLayout wanting to keep all of the JButtons the same size, but when one of them changes (due to the change in its text), it forces them all to change so that they are equal in size. I tried looking for a way to prevent the size of the JButtons from changing, but I couldn't find anything. I also tried calling getBounds() every time the keyListener was active, before any change in text had occurred in the JButton, then I setBounds() to the bounds that I obtained before I changed the text... this didn't work.
ANY suggestions?? Thanks!
-
Try setting the Minimum, Maximum and Preferred sizes of the panel to the same thing. This should keep them from changing.
Hope this helps.
~evlich
Similar Threads
-
By vikassheelgupta in forum Java
Replies: 0
Last Post: 07-22-2005, 05:35 AM
-
By Irina in forum ASP.NET
Replies: 0
Last Post: 11-29-2002, 10:47 PM
-
Replies: 0
Last Post: 12-13-2001, 12:06 PM
-
By Munchkin in forum Java
Replies: 3
Last Post: 03-16-2001, 04:58 PM
-
By Wade Balzer in forum VB Classic
Replies: 0
Last Post: 06-23-2000, 02: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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks