Re: JPopupMenu position changing
- From: Kari Ikonen <mr.kari.ikonen@xxxxxxxxx>
- Date: Sun, 27 Nov 2005 23:19:38 +0200
Martin Buerger wrote:
> ...
> frame.getX() + mouseevent.getX(), frame.getY() + mouseevent.getY()
> ...
Coordinates in the MouseEvent are relative to component receiving the event.
If coordinates are required to be converted between coordinate spaces, then
SwingUtilities.convertX() -methods can be used.
However, best fix would be just to use component receiving the mouseevent as
"invoker" for JPopup.show().
The fact that it seemed to "work" for uppper pane, is just because it's
origin happened to be at (0 0). If there would have been e.g. menubar
visible in JFrame, then popup location would have been failing also for it.
--
KI -- http://kari.world.dy.fi
.
- Follow-Ups:
- Re: JPopupMenu position changing
- From: Martin Buerger
- Re: JPopupMenu position changing
- From: Martin Buerger
- Re: JPopupMenu position changing
- References:
- JPopupMenu position changing
- From: Martin Buerger
- JPopupMenu position changing
- Prev by Date: JPopupMenu position changing
- Next by Date: Re: JPopupMenu position changing
- Previous by thread: JPopupMenu position changing
- Next by thread: Re: JPopupMenu position changing
- Index(es):
Relevant Pages
|