Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JSplitPane and JFrame

 
dziubut dziubucinski
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get better help sooner, post a SSCCE that demonstrates your problem.
 
dziubut dziubucinski
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 2599
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem was c).
Thank you for advices!
all the best
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic