• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Prevent JInternalFrame from being dragged out of the desktop  RSS feed

 
Ranch Hand
Posts: 41
Java Netbeans IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Best forum!

I am working on a MDI application. I have a headache when it comes to preventing internalframes from being dragged out ot
the JDesktopPane object. I have looked into the method setBoundsForFrame in the DefaultDesktopManager class but this is where
i get stucked. Could anyone provide an example on how to prevent the internal frames from disappearing during drag mode,
am i on the right track? So far i have no code sample to provide here to show my effort in this matter but i am working on that.

Any reply or hint is very much appreciated!

Kind regards,
Robert!
 
Master Rancher
Posts: 3189
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Robert,

well, bad news sofar. I've tried to come up with a solution, but to no avail. I report my efforts anyway, in the hope that some more clever people than me will step in.

I added a ComponentListener to the internal frame, and with every move event I check the bounds of the internal frame whether it is still within the desktoppane. That's simple enough, but what I couldn't find is a way to detect that the dragging is over. You want to correct the bounds in that case, if that internal frame is somewhere outside the panel. I tried correcting the bounds while still dragging, but that had horrible consequences.
Well, still thinking about a way to find the moment when the dragging is over. Perhaps there is some accessible MouseListener for the title bar?
 
You totally ruined the moon. You're gonna hafta pay for that you know. This tiny ad agrees:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!