*
The moose likes Swing / AWT / SWT and the fly likes Problem with JSplitPane and JFrame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JSplitPane and JFrame" Watch "Problem with JSplitPane and JFrame" New topic
Author

Problem with JSplitPane and JFrame

dziubut dziubucinski
Greenhorn

Joined: Sep 14, 2010
Posts: 8
Hi all I'm stuck...
I have a frame and jsplitpane on it. JSplitPane has 2 components: (left)panel with several labels and buttons, and (right) jscrollpane which has panel with bufferedimage on it (i draw img using g2.drawImage(...)). Everything works perfect till i try to resize frame - left jsplitpane's component is tryin to disappear (blinkin) and image is moving to left edge of frame. I set left panel (and also scrollpane) minimum size but it doesnt work. Problem appears only when i touch frame..
I would appreciate for any suggestions.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

To get better help sooner, post a SSCCE that demonstrates your problem.


luck, db
There are no new questions, but there may be new answers.
dziubut dziubucinski
Greenhorn

Joined: Sep 14, 2010
Posts: 8


Here it is...Try to load an image (Plik->Otworz) and then grab frame and try to resize..
Btw windows, eclipse JavaSE-1.6
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2153
    
    7
There are a couple of problems:

a) I never like using a null layout because the preferred size is never calculated. Don't know if this is a problem or not.

b) Don't use the add(...) method to add components to the split pane. Use the setLeft/Right component methods.

c) Don't use the removeAll() method. This removes the divider from the split pane. Instead you might just add an empty JPanel.
dziubut dziubucinski
Greenhorn

Joined: Sep 14, 2010
Posts: 8
The problem was c).
Thank you for advices!
all the best
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with JSplitPane and JFrame
 
Similar Threads
JScrollPane and JPanel in JSplitPane(Nested)
JSplitPane (expandable closed)
Unevenly laying out a JFrame
JDialog sizing
How to size jsplitpane?