Article View: borland.public.jbuilder.java.swing
Article #10424Re: JTree and right mouse click!
From: Raf Lenaerts
Date: Mon, 27 Sep 1999 00:00
Date: Mon, 27 Sep 1999 00:00
16 lines
1115 bytes
1115 bytes
You can do it like this (with e is a MouseEvent):
int x = e.getX();
int y = e.getY();
TreePath path = tree.getClosestPathForLocation(x, y);
tree.setSelectionPath(path);
> How do you get the JTree to highlight a node when that node is selected
> with the
> right mouse button? Normally, JTree automatically hightlights a node
> when selected
> with the left mouse button but that's not the case for the right mouse
> button!
> This is useful for pop-up menus on right mouse click on a tree node.
> Thanks for you help..
>
Technical Details
Message-ID:
<7snibb$ei7$1@news3.Belgium.EU.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37EBC41D.577A35CC@magnus.uwaterloo.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,da0b68b96afed5a3 X-Google-Attributes: gid111d45,public From: "Raf Lenaerts" <raf.lenaerts@student.luc.ac.be> Subject: Re: JTree and right mouse click! Date: 1999/09/27 Message-ID: <7snibb$ei7$1@news3.Belgium.EU.net> X-Deja-AN: 529820693 References: <37EBC41D.577A35CC@magnus.uwaterloo.ca> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: EUnet Belgium, Leuven, Belgium X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing