• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Problem with JSplitPane and JFrame

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem was c).
Thank you for advices!
all the best
 
reply
    Bookmark Topic Watch Topic
  • New Topic