🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9462

Re: Complex nodes ina JTree

#9462
From: James Cook
Date: Fri, 24 Mar 2000 00:00
37 lines
2079 bytes
The JRadioButton that you see in the JTree is nothing more than a "picture"
of a JRadioButton. The tree's cell renderer passes a JRadioButton to the UI,
which then takes a snapshot picture, and draws it in the tree. There is no
component to receive those events.

You have to add a mouse listener to the JTree. In this mouse listener, you
will determine which row is being affected, update the node at that row, and
trigger a redraw of the tree. You may want to get on devx.com and search the
Java Pro archives for an article by James Cooper (Javatecture Column). The
article has the words "Forest" and "Trees" in the title. It showed how to
enable checkboxes in a tree. Most of the advanced Swing books also have
these examples.

You may also want to check out: http://www2.gol.com/users/tame/

jim

Thomas Bonk <bonk@cs.uni-sb.de> wrote in message
news:8bf6u9$f81@bornews.borland.com...
> Hello,
>
> I currently work on an application that has a JTree as the central
> widget.
> The nodes in that JTree may be rather complex, e.g. they may contain
> JRadioButtons. Now when the users presses the mouse button over a
> node's JRadioButton, the node itself  becomes selected but the event
> isn't being passed on to the JRadioButton.
>
> Does anybody has any hint how I can solve this problem?
> I already had a look at the Swing reference and the Java tutorial but
> I didn't find anything in order to solve this problem.
>
> Thanks in advance.
> bye, Thomas
>
>
>
Technical Details
Message-ID: <38db79b5.0@news.dot.state.oh.us>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8bf6u9$f81@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,98abf327b24ae051
X-Google-Attributes: gid111d45,public
From: "James Cook" <jimcook.spaminator@remove.for.spam.iname.com>
Subject: Re: Complex nodes ina JTree
Date: 2000/03/24
Message-ID: <38db79b5.0@news.dot.state.oh.us>
X-Deja-AN: 601766621
References: <8bf6u9$f81@bornews.borland.com>
X-Trace: 24 Mar 2000 09:20:37 -0500, dotfw001-dmz.dot.state.oh.us
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.jbuilder.java.swing
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300