?
Solved

Example of tree where clicking on node opens up the menu

Posted on 2006-05-04
12
Medium Priority
?
205 Views
Last Modified: 2010-03-31
I am having a discussion with someone about the way trees behave.  I thought I have seen common behavior where given a tree with items in several nodes, and starting with the tree collapsed, you could click on the label of the node to open up the menu - as if you were clicking on the + to expand.  This has the advantage that you don't need the fine motor skills to click on the tiny +.

I went to look for examples and don't see any.  Has anyone seen this work this way and can you give me examples from the Web? I would need to find code for the control that worked this way, as well.
0
Comment
Question by:cornell256
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 16607389
>> you could click on the label of the node to open up the menu

You could of course, catch the click event on the node and then call expand () to expand it.
0
 
LVL 14

Accepted Solution

by:
hoomanv earned 1200 total points
ID: 16607392
see tree example web starts here
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

you don need to exactly click on the +, clicking on the node is sufficient
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16607409
>> you don need to exactly click on the +, clicking on the node is sufficient

You need to double-click on the node, or click on +
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:hoomanv
ID: 16607415
aha :-)
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 16607437
there is a method that does this

void setToggleClickCount(int)
int getToggleClickCount()       Set or get the number of mouse clicks before a node will expand or close. The default is two. Introduced in 1.3.
0
 

Author Comment

by:cornell256
ID: 16607470
Thanks everyone - I'll take a look!  This is a hugely great group of answers.
0
 

Author Comment

by:cornell256
ID: 16607538
I'm sure there is enough here to close this question.  I'll leave up for awhile in case I have any issues related to these answers.  Thanks again everyone!
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 400 total points
ID: 16607578
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTree.html has an example to handle click events on a tree-node.

There, you could call expandRow () in the event-handler.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16607921
(and I guess you could use it in all versions).

>> void setToggleClickCount(int)

Looks like a good option.
0
 
LVL 9

Assisted Solution

by:Manikandan Thiagarajan
Manikandan Thiagarajan earned 400 total points
ID: 16611281
0
 

Author Comment

by:cornell256
ID: 16628231
Hi, Everyone - thanks for all the help.  These are all helpful posts, I'll increase points and do the best I can to split them three ways.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16628570
:-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month16 days, 18 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question