Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Java-Swing- How to put JTree inside JCombobox

Posted on 2006-11-13
4
Medium Priority
?
1,117 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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:
This video teaches viewers about errors in exception handling.
Suggested Courses

715 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