Article View: borland.public.jbuilder.java.language
Article #8523Re: I need help with my jTree.
From: Torsten Welches
Date: Sun, 18 Mar 2001 10:37
Date: Sun, 18 Mar 2001 10:37
116 lines
3921 bytes
3921 bytes
dhj,
what is the actual problem?
createNodes currently "eats" all exceptions so it will be hard to tell what
line fails. You might want to add a diagnostic "e.printStackTrace();"
Torsten
dhj schrieb in Nachricht <3AB33F41.5CC647B4@cos.de>...
>Hi
>
>I need help with my jTree.
>
>
>I create root node with two lower level
>
>I fill the last level (DefaultMutableTreeNode child1) With the function
>"public void createNodes(DefaultMutableTreeNode top)".
>
>Now I will save the ID from the Database for every Item in the Jtree.
>and will get the ID back with a Doppelkick at the Item.
>
>How can I do this ?????????????????
>
>
>Please help me !!!!!!!!!
>
>
>
>
>
>
>
>////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////
>
>public class Applet1 extends JApplet {
> //create the tree
> DefaultMutableTreeNode top = new DefaultMutableTreeNode("CISCO
>Lehrgang");
>
> JTree jTree1 = new JTree(top);
> JScrollPane treeView = new JScrollPane(jTree1);
> DefaultTreeCellRenderer treeRenderer = new DefaultTreeCellRenderer();
>
> //create the items in the tree
> DefaultMutableTreeNode node1 = null;
> DefaultMutableTreeNode child1 = null;
> }
>
>
>////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////
>
>
>private void jbInit() throws Exception {
> try{
> int i,j;
> database1.openConnection();
> queryDataSet1.open();
> queryDataSet1.first();
> queryDataSet2.open();
> queryDataSet2.first();
>
> for(i = 0; i <= queryDataSet1.columnCount(); i++){
> semester = queryDataSet1.getString(2) + " " +
>queryDataSet1.getInt(1);
> semesterid = queryDataSet1.getInt(0);
> changesemesterid = 0;
> createNodes(top);
> queryDataSet1.next();
> }
> }
> catch(Exception a){}
>
> }
>
>
>////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////
>
>
>
>public void createNodes(DefaultMutableTreeNode top) {
>try{
> int i, count, semesterid2;
> boolean dbtrue;
>
> node1 = new DefaultMutableTreeNode(semester);
>
> top.add(node1);
>
> queryDataSet2.open();
> queryDataSet2.first();
>
> while(queryDataSet2.inBounds() == true){
> kapitel = queryDataSet2.getString(2) + " " +
>queryDataSet2.getInt(3);
> semesterid2 = queryDataSet2.getInt(1);
>
> if(semesterid == semesterid2){
> child1 = new DefaultMutableTreeNode(kapitel);
> node1.add(child1);
> queryDataSet2.next();
> }
> else{
> queryDataSet2.next();
> }
> }
> }
> catch(Exception first){}
> }
>
Technical Details
Message-ID:
<3ab490ff_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!195.14.235.60References:
<3AB33F41.5CC647B4@cos.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,57ec9377f4934d4d X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-18 03:47:01 PST From: "Torsten Welches" <torsten.welches@who.cares.netcologne.de> Newsgroups: borland.public.jbuilder.java.language References: <3AB33F41.5CC647B4@cos.de> Subject: Re: I need help with my jTree. Date: Sun, 18 Mar 2001 11:37:28 +0100 Lines: 118 X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 NNTP-Posting-Host: 195.14.235.60 Message-ID: <3ab490ff_1@dnews> X-Trace: 18 Mar 2001 02:42:07 -0800, 195.14.235.60 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!195.14.235.60