This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes SplitPane causes headache when resizing... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SplitPane causes headache when resizing..." Watch "SplitPane causes headache when resizing..." New topic
Author

SplitPane causes headache when resizing...

Ricardo Estafan
Ranch Hand

Joined: Mar 29, 2004
Posts: 84
Hello all,
I have some difficulty when using a splitpane, this is my code :

Now when i drag the splitpane to his lowest point, which is not the bottom of the pane and then i resize (make smaller) the GUI and afterwards resize (make bigger) again, the splitpane is set to the bottom of the pane and i can't see my tablepanel anymore. Exactly the same in oposite direction, what can i do to solve this?
Thanks for the help!!!
Fuqiang Zhao
Greenhorn

Joined: Jan 07, 2004
Posts: 24
The code have two problems:
1.You should not add the "upperPanel" to contentPane, and then add
it to JSplitPane, the Java GUI container only permit add component
to one container.
2.You should use setPreferredSize intead of setMinimumSize for the
"upperPanel".
change you code to:
upperPanel.setPreferredSize(new Dimension(300, 150));
and remove the code:
contentPane.add(upperPanel, BorderLayout.NORTH);
Ricardo Estafan
Ranch Hand

Joined: Mar 29, 2004
Posts: 84
Thanks a lot,
i did as you said but when i resize the frame still when the splitpane touches the bottom or top of the frame it stays there when i resize back again...
Can someone help?
maggie woo
Ranch Hand

Joined: Dec 18, 2003
Posts: 35
Is it critical that you have the oneTouchExpandable(true)?
Try it without this, and see if it does more or less what you want.
maggie woo
Ranch Hand

Joined: Dec 18, 2003
Posts: 35
Well, here's some code from one of mine that doesn't seem to have this problem (or if it does, then maybe I don't understand the problem):
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SplitPane causes headache when resizing...