Solved

Java-Swing- How to put JTree inside JCombobox

Posted on 2006-11-13
4
1,054 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
4 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
json example 39 132
Groovy:unable to resolve class error 2 70
couple of eclipse 5 23
MySqlDump not dumping triggers 1 17
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now