File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes GridBagLayout not show JTabbedPane right initially but is ok after clicking other tabs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GridBagLayout not show JTabbedPane right initially but is ok after clicking other tabs" Watch "GridBagLayout not show JTabbedPane right initially but is ok after clicking other tabs" New topic
Author

GridBagLayout not show JTabbedPane right initially but is ok after clicking other tabs

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
My test program below does not display the first panel which is on the first tab properly when it starts - every component is crammed together. i.e. does not look good.
Then I click the second tab which display the second panel properly.
Clicking the first tab will display the first panel properly.
I tried to solve this problem by calling "setVisible(false);" at the beginning of the program and calling "setVisible(true);" at the end of the program but to no avail.
Please help to make the first tab look good when my program starts.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2183
    
    7
Post your SSCCE the demonstrates the problem.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10382
    
    8

Add firstPanel & secondPanel to the JTabbedPane and then add the JTabbedPane to the JPanel


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4545
    
    5

albert, we don't have too many rules around here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites

http://forums.oracle.com/forums/thread.jspa?threadID=2253362


luck, db
There are no new questions, but there may be new answers.
albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
Darryl Burke wrote:albert, we don't have too many rules around here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites

http://forums.oracle.com/forums/thread.jspa?threadID=2253362


I will BeForthrightWhenCrossPostingToOtherSites from now on.

http://forums.oracle.com/forums/thread.jspa?threadID=2253362
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: GridBagLayout not show JTabbedPane right initially but is ok after clicking other tabs