Article View: borland.public.jbuilder.java.swing
Article #10156Alternate code that worked
From: Jeff Marendo
Date: Thu, 11 Nov 1999 00:00
Date: Thu, 11 Nov 1999 00:00
19 lines
1317 bytes
1317 bytes
Thanks Tad. I'll try that out in a bit. I was able to get it working with
this, although it's not as smooth as what you suggested:
// Define a class that can be used for double-clicking events within the
tree.
class DoubleClickedMouseListener extends MouseAdapter {
public void mouseClicked(MouseEvent me) {
if(me.getClickCount() == 2)
{
Object obj = me.getSource();
JTree mytree = (JTree) obj;
TreePath path = mytree.getSelectionPath();
System.out.println("Path is "+ path);
String nodeName = path.getLastPathComponent().toString();
System.out.println("Here is your currently selected node: " +
nodeName);
}
}
}
Technical Details
Message-ID:
<80f2gt$9le2@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<809rjs$p3r15@forums.borland.com> <382ACD4A.CBBCDDBD@earthlink.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,795280df6ee112a7 X-Google-Attributes: gid111d45,public From: "Jeff Marendo" <marendoj@commos.com> Subject: Alternate code that worked Date: 1999/11/11 Message-ID: <80f2gt$9le2@forums.borland.com> X-Deja-AN: 547426173 References: <809rjs$p3r15@forums.borland.com> <382ACD4A.CBBCDDBD@earthlink.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Organization: CommTech Corporation X-MSMail-Priority: Normal Reply-To: "Jeff Marendo" <marendoj@commos.com> Newsgroups: borland.public.jbuilder.java.swing