JPopupMenu position changing



Hello,
the situation:
a JPanel containing a JSplitPane with two JScrollPanes; one of the
JScrollPanes has a JTree, the other one a JTable in it. Each, JTree and
JTable have their own MouseListener which pops up with a certain popup menu
(add node, delete node // add attribute, delete attribute). This whole
construct is used in some other program (JFrame).
The problem: the position of the JPopupMenus isn't the same where I clicked
with the mouse (mouseevent.(getX()|getY()). I solved this partly: when I
click in the pane with the JTree the actual position of the click =

frame.getX() + mouseevent.getX(), frame.getY() + mouseevent.getY()

This works for the upper pane. For the lower one with the JTable this
doesn't work. The popup menu is always situated somewhere above the divider
of the two panes. I noticed changing the location of the divider changes
the position of the popup menu even if I click at the exact same position
on the screen without moving anything except the divider.

Well, I'm stuck with this (java version "1.5.0_04", Linux). Any suggestions?

Thank you,
Martin
.



Relevant Pages

  • Re: Auto Resize a JSplitPane Containing a JTree
    ... contains a JTree within it. ... the user expands the JTree, he/she must also manually resize the ... I would rather have it so that the pane automatically ... then I want it to not resize). ...
    (comp.lang.java.gui)
  • Re: Problem adding/removing items to already visible components
    ... out the contents in the different panes of the tabbed pane, ... components could only be added to containers before the container is ... What I am saying is that if I remove the scroll pane with ... the JTree in it upon closing the first ...
    (comp.lang.java.programmer)
  • Re: Auto Resize a JSplitPane Containing a JTree
    ... but I don't understand how that can be used to resize the left pane ... when a JTree is expanded beyond the boundaries of that pane. ... the user expands the JTree, he/she must also manually resize the ...
    (comp.lang.java.gui)