Solved

Java-Swing- How to put JTree inside JCombobox

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 82
ejb mdb examples 1 8
ejb message driven bean mdb creation steps 2 24
learn programming 8 42
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 functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

828 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