This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Problem with JSplitPane and JFrame

 
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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • 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
 
Rancher
Posts: 3140
27
  • 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
 
You would be much easier to understand if you took that bucket off of your head. And that goes for the tiny ad too!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!