• 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

Immobile JInternalFrame

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi does anyone know how to make a JInternalFrame
immovable or immobile.
that is disable the drag making it impossible for someone to drag it
thanks
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I am pretty sure you could add a JInternalFrameListener and listen for the drag event. Anytime someone drags it, just setLocation(x,y) back where it should go.
However, I think a cleaner approach would be to not use JInternalFrames at all. If you aren't moving the frame around, isn't it just a JPanel? I would use a JPanel in place of a JInternalFrame and just statically place it where you want it.
Either way would work, but I like the JPanel idea better.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The best way to do this is provide a new DesktopManager to the JDesktopPane that contains this JInternalFrame. Basically, just override the dragFrame() method to ignore moving a frame based on some criteria. In my example I create a marker interface, but you could keep it simple and base it on a predefined title or something if you don't need that much functionality.

reply
    Bookmark Topic Watch Topic
  • New Topic