Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Java-Swing- How to put JTree inside JCombobox

Posted on 2006-11-13
4
Medium Priority
?
1,141 Views
Last Modified: 2008-02-01
Hello
I want to implement a Jcombobox in that i want to put JTree with editable leaf only. So if anyone know this how to do this. Can you send me a sample of working code.

Thanks
Manish
0
Comment
Question by:manish14
3 Comments
 
LVL 2

Expert Comment

by:saintsairforce
ID: 17953802
Not sure if I completely understand. Do you just what to make it so only the leaf of a JTree can be editied?  If this is the case the I can help you right away here. I'm assuming you know how to get the path of your tree , with the TreePath and the getPathForLocation function. If not try to google them. Next convert this to a TreeNode  and then use the command

if (node.getChildCount()==0)
{
 //you are at the leaf
}
else
  //you are not at the leaf.


useful links

Treenode
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/tree/TreeNode.html

JTree
http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTree.html


Hope this helps

Cheers,
Ricky
0
 

Author Comment

by:manish14
ID: 17978257
no, i think you didn't get what i want, anyway i found an example on net. I'll try that solution
http://www.jroller.com/page/santhosh?entry=tree_inside_jcombobox 

hope this should work for me.

Thanks for your comments

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18191800
PAQed with points refunded (20)

Computer101
EE Admin
0

Featured Post

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!

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

877 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