Solved

Java-Swing- How to put JTree inside JCombobox

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

747 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

9 Experts available now in Live!

Get 1:1 Help Now