Java - Problem in JTree
Posted
by Yatendra Goel
on Stack Overflow
See other posts from Stack Overflow
or by Yatendra Goel
Published on 2010-03-09T07:20:05Z
Indexed on
2010/03/09
7:21 UTC
Read the original article
Hit count: 376
There are 2 JTree
: JTree1
and JTree2
. Note that the nodes (country, city, colors, blue ...) all will be implemented as JCheckbox
es so that user can select particular colors for each city or for the whole country by selecting their corresponding checkboxes.
Problems:
Q1. I want that each country or city can have its own colors selected. Means if a user wants city1.1
to have colors blue and violet and city2.1
to have colors red, then he first have to select the city1.1
checkbox and then select blue and violet, and after that when he selects city2.1
, then the checkboxes blue and violet are deselected automatically so that user can select the colors for city2.1
. But when the user selects the city1.1
again, then the JTree2
should show the selected colors (bule and violet) for city1.1.
So for this purpose, Is the JTree (with its nodes as checkboxes) correct option to implement or I should use some other
JComponent
?If JTree is a correct option, then how can I remember the colors of each city?
© Stack Overflow or respective owner