Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Detecting JInternalFrame movement

 
Michael Crutcher
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to be able to detect a JInternalFrame's movement so that I can sync the movement of two frames. InternalFrameListner does not seem to be notified when an internalframe is moved to another place.
Right now I'm thinking that I'll need to detect a click and drag on the JInternalFrame, then ask it for its location, then set the location of the other frame.
Am I missing something? Is there a simpler way to do this?
Thanks,
Michael Crutcher
 
saager mhatre
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could track movement on a javax.swing.JInternalFrame using java.awt.event.ComponentListener. Add your listener to the JInternalFrame's listener queue using JInternalFrame.addComponentListener(ComponentListener) and listen for the ComponentEvent from ComponentListener.componentMoved(ComponentEvent). Then use ComponentEvent.getSource() to retrieve a reference to the JInternalFrame that moved and check for its location.

A little example should get you on your way!

[ July 19, 2002: Message edited by: saager mhatre ]
 
Michael Crutcher
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, thanks!
 
saager mhatre
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Always glad to be of help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic