• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSplitPane problem

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there;

I'm creating a GUI where I have a JFrame which has a JSplitPane that works as a divider between a JDesktopPane on one side and JTextArea on the other side. The problem is that I'm using the JDesktopPane side to:
1- Add new "JInternalFrames"
2- Draw some "graphics"

When I try to resize the JSplitPane. My JDesktopPane is repainted which undo all the changes I made in it. For example, I moved several JInternalFrames and then I resized the JSplitPane and that made my JInternalFrames go back to their initial locations. How can I avoid this? In other words, How can I cancel the effect of resizing JSplitPane on the contents of my JDesktopPane?

Thanks for help,

Java Lover.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sounds like you're doing your drawing via getGraphics(),
and your problem is the exact reason why getGraphics() should not be used.

it draws things once only, then any change and *poof* its gone.
 
Osama Al-Haj Hassan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I have not started drawing yet. But I think If I draw anything, then I suspect the result to be the same as what is happening with the JInternalFrame. For now, I want the JInternalFrame problem to be solved. Can anyone solve the JInternalFrame problem which I explained earlier???

Thanks,

Java Lover.
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a small program to try to replicate your problem, and I couldn't: the internal frames remained where I placed them when I moved the splitpane's divider. Here is the code that demonstrates this:


I think that the problem is that you've got a bug in your code, and for us to help you solve it, you'll have to post that code, preferably in a small compilable and runnable program similar to what I've posted above. Best of luck.
 
Osama Al-Haj Hassan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I checked you code Pete. This is exactly what I want. May be there is a bug in my code.

One more thing, if I ("move the internal frames") outside the area boundaries, I want a horizontal and vertical scrollbars to appear so that I can see the rest of the internal frames. How can I do that? Do I have to implement an event handler that detects x,y locations for internal frames when they are moved?

Thanks Pete for help.

Java Lover.
 
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic