Re: How can I "glue" JDialog to an owning JFrame ?
- From: Thomas Fritsch <i.dont.like.spam@xxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 13:09:19 GMT
bobjan wrote:
JFrame has addComponentListener and addMouseMotionListener methods, inherited from Component. So you might want:I have a non-modal JDialog with a JFrame as an owner. On a mouse right-click the dialog becomes visible at the mouse position. And it works fine. But when I start dragging JFrame , the JDialog remains on the same screen position. Is there a way to "glue" the dialog to the frame ?
yourFrame.addComponentListener(new ComponentAdapter()
{
public void componentMoved(...) { ... }
});
or
yourFrame.addMouseMotionListener(new MouseAdapter()
{
public void mouseDragged(...) { ... }
});
But another question:
Why do you want to move the dialog at all, when the user moves the frame? I think that would surprise your user, and hence would contradict to the "principle of least astonishment" <http://www.google.de/search?q=%22principle+of+least+astonishment%22>
And consider a desperate user's question "I just moved the dialog totally off the screen. How can I close it now?" ;-)
--
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@').
- References:
- How can I "glue" JDialog to an owning JFrame ?
- From: bobjan
- How can I "glue" JDialog to an owning JFrame ?
- Prev by Date: JMenu is covert by an external application
- Next by Date: UTF-16 encoded HTML
- Previous by thread: How can I "glue" JDialog to an owning JFrame ?
- Next by thread: JMenu is covert by an external application
- Index(es):