JTree Display Update

I use a JTree that requires periodic changes to its nodes. I cannot get the display of the JTree to update however. I have tried many different things such as JTree.updateUI(), DefaultTreeModel.reload(), DefaultTreeModel.nodesChanged().
Currently my code looks like this:
// initialization
createTreeNodes();
treeModel = new DefaultTreeModel(rootNode); treeModel.addTreeModelListener(this);
tree = new JTree(treeModel);
// code invoked whenever changes to JTree must be made
createTreeNodes();
treeModel.reload();
tree.repaint();
// this is the function "createTreeNodes"
private void createTreeNodes()
rootNode = new DefaultMutableTreeNode("File Name");
DefaultMutableTreeNode headerNode = new DefaultMutableTreeNode("Header 1");
for(int i=0; i<cardArray.size(); i++)
DefaultMutableTreeNode cardNode = new DefaultMutableTreeNode(cardArray.get(i).getFront() + " (" + (i+1) + ")");
// above line simply creates a node with a string
System.out.println(cardArray.get(i).getFront() + " (" + (i+1) + ")");
// the above line recreates the code 2 lines above for debugging purposes
headerNode.add(cardNode);
// above code adds child to parent
rootNode.add(headerNode);
// above code adds parent to root node
}The tree is updated in createTreeNodes().
If a file is opened by a user, cardArray changes and I reflect these changes by updating the JTree. The System.out.println() statement in the createTreeNodes() function prints the expected data to the console, which proves that the data is being updated. The display of the JTree does not update however.
And for further explanation about my code:
- the part that I commented "Initialization" is located in the program constructor. At this point cardArray is equal to 0, and the program simply displays one leaf node with a value of 'null'
- If the user opens a new file, cardArray (an ArrayList) is updated. I call the createTreeNodes() function which updates the JTree data. I also call treeModel.reload() to signal to the DefaultTreeModel that its data has been updated
- the function 'createTreeNodes()' simply adds DefaultMutableTreeNodes to the JTree hierarchy
My thanks in advance for any help you may be able to provide.

Hi,
I have taken a look at your code, and I can't see that you are updating the tree. Your createTreeNodes method does only create a new root node, and stores the reference in the attribute rootNode. That does neither affect the root or the model created in the initialization block.
/Kaj

Similar Messages

  • Display Updated values  in table from server (iphone)

    hello everyone,
    I am having problem while displaying updated data in a table. I m getting data from a server and then trying to displaying it in a table view. but data in table only update after scroll.
    I also tried to call the method [myTableView reloadData] inside main thread. but that doesnt solve to problem too. and my GUI doesnt work when I does that.
    Can anyone solve my prob.
    Thanx in advance.

    Hi..Friends..finally i got the solution for this problem, we have to use performselector method to varying the message at run time.if u want any help click this link,http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC /Articles/ocSelectors.html
    Thanku....

  • HT204266 App store does not display updates

    App store will not display updates, any body know how to fix this.

    There are various other threads here that cover the same issue...with that being said
    The problem could very well be on Apple's end...maybe a server issue with the App Store. I just checked my iPhone 5 updates under Wi-Fi and get nothing but a white "Updates" screen with the busy cog spinning endlessly. Everything else loads fine...web pages & all other aspects of the iTunes Store. Updates is the only thing that is not working.
    Checking the System Status page (http://www.apple.com/support/systemstatus/) show no issues, however it may not have been updated/Apple is not yet aware of the issue.

  • How i can enter information from Database to jtree and update it

    How i can enter information from Database to jtree and update it

    Is the memory cache enabled (about:cache)?<br />
    You can open about: pages via the location bar like you open a website.
    *http://kb.mozillazine.org/browser.cache.memory.enable

  • Thunderbolt display update 1.2 causes unresponsive display

    After running the thunderbolt display update 1.2 my display now displays the very thing the update was designed was supposed to correct - a black unresponsive screen (which I have ironically never suffered fro at all ever - grrrr).
    I cannot get the thunderbolt display to come back to life although the mac can see it and thinks it is there and is extending the desktop to it.
    Anyone else have this issue or ideas to solve?

    ..and solved. The secret seemed to be to follow these steps. Have no idea if they are all necessary but it worked for me.
    In Display preferences hit gather window to bring the thunderbolt display preferences onto the mac screen
    Uncheck Adjust brightness automatically and save
    disconnect the display from the mac.
    Restart the mac
    Power down the display and leave for a few minutes
    Power up the display
    Reconnect the display to the mac
    The screen returned to life. Let's see if it stays that way, I will report if it doesn't.

  • How do I control the order in which JTree displays nodes?

    I'm trying to display the nodes in a JTree in a specific fashion, but I can't figure out how to change the order JTree displays them in. It seems the default is alphabetically, with leaves first and nodes with children second. I've spent a few hours pouring through the documentation, but I haven't been able to find out what I need to do. Anyone know?

    They are displayed in the order they are added on the same level.

  • HT6093 Thunderbolt Display Update fail

    I continue to get notices of a Thunderbolt Display update but it fails each time before loading. What should I do?

    Same.
    I have three thunderbolt displays connected to a Mac Pro. I got the error message, then read that no more than two displays could be connected during the update. I disconnected one of them and restarted. Then connected the other and disconnected the first and restarted again.
    I'm not sure any of that worked and have no "active" notification that they were updated. I checked the firmware version following that update per the instructions and they match the version, but I'm still getting the random flicker.

  • Nokia 930 display update breaks phone

    Hi there was wondering if you guys are aware of this lots of people on the Windows phone central forum are reporting problems with the app update of display.
    i have this problem as well. basicly before you update the display app the screen is all black as it should be when setting alarm or ajusting brightness in the bottom half of the screen. however as soon as you update the display app it cause the bottom half of the screen to appear illuminated from the sides like a LCD display. I assume this is the fault as when i have restored my phone to factory and dont install the update everything is fine and the screen stays black as it should then update cause this problem again.
     i dont know what info you need but its a 930 on lumia cyan built on 18/06/2014, RM-1045_1066 VOD-GB, unusre how to get info of the display update but with out update it dosnt have the 3 options only has the 2.

    Well, we're all 'just' users here, although I do not think Microsoft will give a final date, we know from experience it does not take them very long in these cases usually.
    Click on the blue Star Icon below if my advice has helped you or press the 'Accept As Solution' link if I solved your problem..

  • Stuck on White Screen on Thunderbolt Display Update - Lion

    Anyone else have this problem? After the Thunderbolt display update, I get a white screen at the login after I restart my MacBook Pro. I either have to unplug my laptop so I can see the screen again to login, or I can hit enter and then blindly put in my password while he screen is blank and then it will pop back up again. It's annoying.
    I didn't have this problem running Snow Leopard and I reset the PRAM and SMC already. This is also a clean install of Lion.

    I've actually just posted a similar post on the Thunderbolt thread. Is there anyway to rollback the firmware? This is so frutrating to have to wait so long before actually getting to the login screen.
    If the Thunderbold display is unplugged then the MacBook has no problems and instantly goes into the login screen - on the other hand having the Thunderbolt display connected to the MacBook - same as you describe - Power on Macbook - white screen for about 1-3 minutes before the Apple logo appears and proceeds to the login screen
    Hope someone can read and sort thins out soon.

  • Question with updating JTree Display

    Hello all,
    I have a question about how to change what a JTree is displaying. Currently I have classes called ElementTreeFrame, ElementTree, ElementTreeModel, and, of course, Element. The ElementTreeFrame is simply the frame where I store a ElementTree, it has 2 buttons (JButtons at the bottom) Add and Open. I am trying to Dynamically add an Element to my ElementTree.
    The Element class has a Vector in it, called childElements. When the user clicks Add, a new Element is added to the Vector. Let me explain a bit further. The element that is currently selected is returned via
    parentElem = (Element)parentPath.getLastPathComponent();
    Then a new Element is added by saying
    parent.childElements.insertElementAt(child, parent.getChildCount());
    which is code the Vector class provides. parent.getChildCount() simply returns the number of children present so that the child (the new Element being added) can be inserted in the right place.
    Here is my problem. When I first add an Element, it works fine. As a matter of fact, I can add as many Elements as I want and it will work fine. That is, until I manually expand the tree. When an Element is added, the tree doesn't expand. So I can add as many as I want, and it will work fine. The instant I coudlbe click on my Element to expand the tree, I can no longer insert a new Element. Technically, it gets inserted correctly, I know this because getChildCount remains correct, but the display is no longer correct. The line that extends from the folder to the new leaf is broken.
    I need to find a way to refresh my tree display. I am at a complete loss on how to do this. I have read about firingTreeNodesInserted or using reload, or a bunch of other methods but I am confused due to an overload of different methods.
    Can anyone tell me what my train of thought should be to do this? I'd just like a simple way for the nodes to be displayed correctly.
    Thank you so much,
    Nick

    Neverrmind, I figured it out. A call to to eTree.updateUI() handled it just nice.
    Thanks to myself, for being so hot.

  • JTree not updating

    i've already make changes to the nodes in a jtree, then i try using
    jtree.repaint();, jtree.validate();, all didn't update the display..
    why is it like that?
    i try using jtree.updateUI(), it works but got some problem when calling from other class(can't understand the reason) it give this error:
    java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicTreeUI.paintRow(BasicTreeUI.java:1309)
         at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1120)
         at javax.swing.plaf.metal.MetalTreeUI.paint(MetalTreeUI.java:139)
         at javax.swing.plaf.ComponentUI.update(ComponentUI.java:39)
         at javax.swing.JComponent.paintComponent(JComponent.java:395)
         at javax.swing.JComponent.paint(JComponent.java:687)
         at javax.swing.JComponent.paintWithBuffer(JComponent.java:3878)
         at javax.swing.JComponent._paintImmediately(JComponent.java:3821)
         at javax.swing.JComponent.paintImmediately(JComponent.java:3672)
         at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
         at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:124)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

    I suppose you are adding/removing nodes of the tree using a TreeModel or TreeNode
    So then calling updateUI may not be good enough
    You should be firing the events fireTreeNodesRemoved/fireTreeNodesInserted
    You can do the same using the methods nodesWereRemoved/nodesWereInserted
    of TreeModel
    Incase you are just changing some properties of the node , You may use nodesChanged

  • JTree: Problems updating the nodes size

    Hi,
    I'm trying to update the content of a JTree and I wonder how it
    really works, since the paint() method doesn't seem to call the
    renderer.
    My situation: Imagine a JPanel splited in two by a JSplitPane. In
    the left is the tree. Each node in the tree shows two panels, one
    aligned to the left, and another to the right. I need that the panel
    containing the two use all the available space in the left part of the
    Split panel.
    My solution: I pass the left JPanel to the tree renderer, so that
    it can get the width from it (inside the
    getTreeCellRendererComponent()) to build the return JPanel with the
    correct size. My logic is that since each time you move the JSplitPane
    the JTree paint() method is invoked the renderer can return the
    correct JPanel with the correct size that will be painted then in the
    screen.
    My problem: Doens't work. When I render the tree, the renderer is
    invoked, but it doesn't change its size (I can change the color based on the width, but not the node size). Only when I collapse & expand a node, it correctly takes into account the .setPreferredSize() and returns the JPanel with the correct size.
    The only way I found to update the tree involves to catch the
    JSplitPane event and call updateUI() in the tree, something that, I
    think, it's certainly not the correct way to do it.
    Any explanation of why this doesn't work would be really great. Any
    pointer to a web resource explaining in deep how Swing components work (specially the JTree) would be a godsend.
    Thanks,
    - Juancho

    My situation: Imagine a JPanel splited in two by a JSplitPane. Got it.
    In the left is the tree. In the left side of the JSplitPane is a JTree.
    Each node in the tree shows two panels,Maybe... on the right side of the JSplitPane are two Panels in which the data depends on which node is selected in the JTree???
    Maybe... you have a custom TreeCellRenderer which displays a pair of panels in place of the standard JLabel???
    one aligned to the left, and another to the right. To the left of what??? To the right of what???
    I need that the panel containing the two use all the available
    space in the left part of the Split panel.Panel containing the two what??? I thought the left part of the SplitPanel contained a JTree???

  • Need to automatically display update date and user in update form field

    Hi all,
    Hopefully someone can help me with this... I am using dreamweaver cs4 and php/mysql.  I have a database table that will be updated by 1-5 different people at random times.  I have everything set up and working, as far as the update function, delete function, add new, etc.  In my update form the last two fields are Last Updated and Last Updated By.  There are fields in the table called 'last_updated' (formatted in PHPmyadmin as timestamp) and 'last_updated_by'.  But how do I get them to update on their own?  Right now it is showing the first entry into the field which I did in the PHPmyadmin table, but it is not updating automatically.  It would be a nice field to have so that we know who has worked on the table and when it was last updated, without the user manually typing that in, which I am sure they would forget to do.  By the way, users will login to this with a username and password before editing the records.
    This is the code for the last row in the update form with those two fields.  It is pulling the fields from the database table, but they do not update automatically...
    <tr>
              <th class="blackfont" scope="row">
                <div align="right">
                  <label for="last_updated">Last Updated Date:</label></div>
              </th>
              <td colspan="3" class="blackfont"><input name="last_updated" type="text" id="last_updated" tabindex="47" value="<?php echo $row_getMember['last_updated']; ?>" size="15" />
                <label for="last_updated_by">Last Updated By:</label>
                <input name="last_updated_by" type="text" id="last_updated_by"tabindex="48" value="<?php echo $row_getMember['last_updated_by']; ?>" size="15" /></td>
    </tr>
    Thanks!
    Kathy

    Here is all the code the the Admin Login page...
    <?php session_start(); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/TherapyPetsTemplate2.dwt" codeOutsideHTMLIsLocked="false" -->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>TPGC Administrative Login Page</title>
    <!-- InstanceEndEditable -->
    <link href="css/twoColFixLtHdr.css" rel="stylesheet" type="text/css" /><!--[if IE 5]>
    <style type="text/css">
    /* place css box model fixes for IE 5* in this conditional comment */
    .twoColFixLtHdr #sidebar1 { width: 230px; }
    </style>
    <![endif]--><!--[if IE]>
    <style type="text/css">
    /* place css fixes for all versions of IE in this conditional comment */
    .twoColFixLtHdr #sidebar1 { padding-top: 30px; }
    .twoColFixLtHdr #mainContent { zoom: 1; }
    /* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
    </style>
    <![endif]-->
    <script src="JavascriptFiles/mootools.js" type="text/javascript"></script>
    <style type="text/css">
    <!--
    body {
    background-color: #FFF;
    margin-top: 25px;
    margin-bottom: 25px;
    margin-left: 25px;
    margin-right: 25px;
    background-image: url(Images/images-2.jpg);
    background-repeat: repeat;
    .twoColFixLtHdr #container #webstunning_video_player {
    margin-top: 15px;
    border-top-style: none;
    border-right-style: none;
    border-bottom-style: none;
    border-left-style: none;
    -->
    </style>
    <script src="ajxmenu.js" type="text/javascript"></script>
    <style type="text/css">
    <!--
    body,td,th {
    color: #FFF;
    font-size: 100%;
    font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
    .Italic {
    font-style: italic;
    -->
    </style><link rel="stylesheet" href="ajxmenu1.css" type="text/css" />
    <script src="ajxmenu1.js" type="text/javascript"></script>
    <link rel="stylesheet" href="ajxmenu2.css" type="text/css" />
    <script src="ajxmenu2.js" type="text/javascript"></script>
    <link rel="stylesheet" href="ajxmenu4.css" type="text/css" />
    <script src="ajxmenu4.js" type="text/javascript"></script>
    <!-- InstanceBeginEditable name="head" -->
    <script language='JavaScript' type='text/javascript' src='HDWRegistrationAndLogin/validatescripts.js.php'></script>
    <!-- InstanceEndEditable -->
    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-28303973-1']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    </script>
    </head>
    <body class="twoColFixLtHdr">
    <div id="container">
    <div id="header">
    <!-- end #header -->
    </div>
    <div class="AJXCSSMenuScYdSZA"><!-- AJXFILE:../ajxmenu4.css -->
    <ul>
    <li><a href="Index.html">Home</a></li>
    <li><a class="ajxsub" href="AboutUs.html">About Us</a>
      <ul>
       <li><a href="AboutUs.html">About Our Group</a></li>
       <li><a href="Board%20of%20Directors.html">Board of Directors</a></li>
       <li><a href="ServicesWeProvide.html">Services We Provide</a></li>
       <li><a href="TPGCintheNews.html">TPGC in the News</a></li>
      </ul>
    </li>
    <li><a href="Facilities.html">Facilities</a></li>
    <li><a class="ajxsub" href="GetStarted.html">Get Involved</a>
      <ul>
       <li><a href="DoesYourPetHaveWhatItTakes.html">Does Your Pet Have What it Takes?</a></li>
       <li><a class="ajxsub" href="GetStarted.html">Get Started</a>
        <ul>
         <li><a href="Training.html">Training</a></li>
         <li><a href="Testing.html">Testing</a></li>
        </ul>
       </li>
      </ul>
    </li>
    <li><a class="ajxsub" href="HowYouCanHelp.html">How You Can Help</a>
      <ul>
       <li><a href="HowYouCanHelp.html">Ways to Help</a></li>
       <li><a href="DonorsList.html">Our Donors and Sponsors</a></li>
      </ul>
    </li>
    <li><a class="ajxsub" href="MemberProfiles.html">Happy Tales</a>
      <ul>
       <li><a href="MemberProfiles.html">Member Profiles</a></li>
       <li><a href="MemberStories.html">Member Stories</a></li>
       <li><a href="Testimonials.html">Testimonials</a></li>
       <li><a href="PhotoGalleries.html">Photo Gallery</a></li>
      </ul>
    </li>
    <li><a href="FAQs.html">FAQs</a></li>
    <li><a href="Links.html">Links</a></li>
    <li><a href="Form-ContactUs.html">Contact Us</a></li>
    <li><a class="ajxsub" href="#">Login</a>
      <ul>
       <li><a href="MemberLogin.php">Member Login</a></li>
       <li><a href="BoardLogin.php">Board Login</a></li>
       <li><a href="AdminLogin.php">Admin Login</a></li>
      </ul>
    </li>
    </ul>
    <br />
    </div>
    <div id="sidebar1">
       <div>
        <div align="center">
        <br />
    <br />
    <div id="Events">
    <br />
    <div class="EventsHeading" id="EventsHeading">Upcoming Events</div>
    <br />
    <span class="EventsText">
          <!--Date-->
          </span>
          <span class="EventsDate">March 11th</span>
          <span class="EventsText">
    <!--Event Name-->      Members Meeting
          <!--Time-->
          </span>
    <span class="EventsTextDescription"><!--Description-->
    <strong class="MemberPageItemFont">CANCELLED! </strong></span>
    <br />   
    <span class="EventsDate">March 25th</span>
          <span class="EventsText">
    <!--Event Name-->Testing
    <!--Time-->
          </span>
    <span class="EventsTextDescription"><!--Description-->
    12-3 pm   At Bethesda North Hospital. Please contact <a href="mailto:[email protected]?Subject=Sign up for Testing March 25th">Elaine Waxler</a> to sign up for testing, or <a href="mailto:[email protected]?Subject=Question about Testing March 25th">Glenna Mockbee</a> for more details.</span>
    <br />
          <span class="EventsDate">April 15th</span>
          <span class="EventsText">
    <!--Event Name-->      Board Meeting
          <!--Time-->
          </span>
    <span class="EventsTextDescription"><!--Description-->
    12-3 pm   At Bethesda North Hospital. Please contact <a href="mailto:[email protected]?Subject=Delta Testing Question">Glenna Mockbee</a> for details.</span>
    <br />
          <span class="EventsDate">May 20th</span>
          <span class="EventsText">
    <!--Event Name-->      Member Luncheon
          <!--Time-->
          </span>
    <span class="EventsTextDescription"><!--Description-->
    10-4 pm   At Bethesda North Hospital. More details to come.</span>
    <br />
    </div>
        </div>
        <br />
          <hr align="center" width="200" />
          <div align="center"><a href="http://www.facebook.com/pages/Therapy-Pets-of-Greater-Cincinnati/324108054289534?skip_nax_ wizard=true#!/pages/Therapy-Pets-of-Greater-Cincinnati/324108054289534?sk=wall" target="_blank"><img src="Images/Facebook.jpg" alt="Facebook" width="144" height="44" border="0" /></a><br />
            <br />
          </div>
          <hr align="center" width="200" />
          <div align="center">
          <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="TB844UZWVAUVU"><br />
    <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
    <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </form>
    <br />
            <br />
    <hr align="center" width="200" />
    <!-- InstanceBeginEditable name="SideBar" -->
        <div>
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
         <br />
    <br />
    <br />
        </div>
        <!-- InstanceEndEditable --><br />
      <br />
      <br />
          </div>
    </div>
    </div>
    <!-- InstanceBeginEditable name="MainContent" -->
    <div id="mainContent">
    <span class="GreenHeadingH2">Admin Login</span>
      <br />
      <br />
      <br />
      <br />
    <div align="center"> 
      <p><span class="UnderConstructionFont"><em><strong>***UNDER CONSTRUCTION - PLEASE DO NOT USE YET!</strong></em></span>***</p>
      <p> </p>
      <p><span class="UnderConstructionFont"><em>Please login to manage TPGC lists and information.</em></span><em></em></p>
      <p> </p>
      <p>
    <?php if (!$_SESSION["logged_3"]) { ?>
      </p>
      <form id="hdwlogin" name="hdwlogin" method="post" action="http://www.therapypetsofgreatercincinnati.org/AdminPage.php" onsubmit="return HDW_verify_Login(this)">
        <div id="hdwdivlogin">Enter your username:<br />
          <input type="text" name="username" id="username" />
          <br />
          Enter your password:<br />
          <input type="password" name="password" id="password" />
        </div>
        <div id="hdwdivILMP" style="display:none;"> Enter your email:<br />
          <input type="text" name="hdwILMPemail" id="hdwILMPemail" />
          <br />
          <input type="button" onclick="javascript:HDW_submitILMP()" value="Submit" />
          <a href="javascript:HDW_showLogin()">Login Again</a></div>
        <input type="hidden" name="hdwtable" id="hdwtable" value="3" />
        <input type="hidden" name="hdwokurl" id="hdwokurl" value="http://www.therapypetsofgreatercincinnati.org/AdminPage.php" />
        <br />
        <div id="hdwdivLink" >
          <p>
            <input type="submit" name="subbtn" id="subbtn" value="Submit" />
            </p>
          <p><a href="javascript:HDW_showILMP()">I lost my password</a></p>
        </div>
      </form>
      <p>
        <?php } else { ?>
        Logged as <?php echo $_SESSION["logged_username"]; ?>.
        <br />
      <br />
      <a href="javascript:HDW_logout()">Click here to logout</a>.
      <?php } ?>
      </p>
      <p> </p>
       <p><span class="Caption">To change your password, contact <a href="mailto:[email protected]?Subject=Change my TPGC board password">webmaster</a></span><br />
    </div>
    </div>
    <!-- InstanceEndEditable --><br />
    <br class="clearfloat" />
    <div id="footer">
        <p><img src="Images/x-knead[1].gif" width="98" height="47" align="absmiddle" />        Copyright 2012 Therapy Pets of Greater Cincinnati, a 501(c)(3) organization     Last Updated
          <!-- #BeginDate format:Am3 -->02/25/2012<!-- #EndDate -->           Website by <a href="mailto:[email protected]?Subject=Question or Comment for Webmaster">Kathy McRoberts</a>        <img src="Images/terrier15.gif" width="63" height="60" align="absmiddle" />
          <!-- end #footer -->
          <br />
        </p>
    </div>
    <!-- end #container --></div>
    </body>
    <!-- InstanceEnd --></html>

  • JTree, displaying data from a database

    Hi, im doing an application that will display the listing of courses, and allow users to book them. For the display of courses, i plan to use JTree to display them.
    However my problem arises from fetchin data and putting them into the tree.
    This file connects to the database and fetch the 'Course Category' and puts it in an Array.
    public ArrayList<CourseCategory> getCategory() {
    ArrayList<CourseCategory> categoryArray = new ArrayList();
    try {
    String statement = "SELECT * FROM Category";
    rs = stmt.executeQuery(statement);
    while (rs.next()) {
    CourseCategory cc = new CourseCategory();
    cc.setCategoryID(rs.getInt("CategoryID"));
    cc.setCategoryName(rs.getString("CategoryName"));
    categoryArray.add(cc);
    rs.close();
    stmt.close();
    con.close();
    catch (Exception e) {
    //catch exception     }
    return categoryArray;
    CourseCategory File has the necessary accessor methods, and a toString method to display out the category name.
    The main file, which has the JTree
    public DisplayCoursesGUI() {
    try {
    courseDB = new CourseDB();
    courseDB.getCategory();
    catch (Exception e) {
    //catch exception }
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("");
    for (int i=0;i<courseDB.test2().size();i++) {
    category = new DefaultMutableTreeNode(courseDB.getCategory());
    top.add(category);
    Codes for JTrees as follows.
    I have the output of
    e.g.
    [MICROSOFT OFFICE APPLICATIONS, WEB APPLICATIONS] repeated twice in the tree. Im hoping to achieve the following effects
    e.g.
    -MICROSOFT OFFICE APPLICATIONS
    ----Microsoft Word
    ----Microsoft Powerpoint
    -WEB APPLICATIONS
    -----Adobe Photoshop
    I have 2 MS Access Table.[Category]ID, CategoryName. [COURSE]ID,CourseName,CategoryID. They have a relationship.
    How do I modify my codes to get what i hope to achieve? Help really appreciated.
    Thank you!!

    Hi,
    If you read my first post, I wanted to achieve this effect.
    ----CategoryName1
    ----------SubCategoryItem1
    ----CategoryName2
    ----------SubCategoryItem2
    My Table Structure.
    CATEGORY TABLE
    ID (autonumber), Name(string)
    COURSES TABLE
    ID(autonumber),Name(string), CategoryID(int)(A Relationship is link to Category Table-ID)
    I have managed to retrieve the items from the Category Table into a result set, and I have added the result set into an Array (See 1st post)
    Now, the problem comes when im tryin to do a for loop to display out the categorynames from the array(see 1st post again).
    Now my array prints out as follows
    e.g.
    [CategoryName1,CategoryName2]
    And if i put a for look into my application to display a JTREE,
    My end results is
    ------[CategoryName1, CategoryName2]
    ------[CategoryName1, CategoryName2]
    How should I ammend my codes to get:
    -------CategoryName1
    -------CategoryName2

  • JTable display update

    I created my own Model to sum in last line and column the values of the previous cells. Unfortunately the update is only done for either column or line. Never for both.
    E.g.
    class myTest extends DefaultTableModel{
    public int getColumnCount() {
    return 5;
    public void setValueAt(Object value, int row, int col) {
    Vector rowVector = (Vector) dataVector.elementAt(row);
    rowVector.setElementAt(value, col);
    rowVector.setElementAt("nothing", 3);
    TableModelEvent event = new TableModelEvent(this, row, row, col);
    fireTableChanged(event);
    rowVector = (Vector) dataVector.elementAt(4);
    rowVector.setElementAt("Sum", 2);
    TableModelEvent event1 = new TableModelEvent(this, 2, 2, 4);
    fireTableChanged(event1);
    public class TableTest{
    public static void main(String[] args){
    JTable table = new JTable(5, 5){        };
    JTextField tf = new JTextField();
    tf.setBorder(BorderFactory.createEmptyBorder());
    table.setDefaultEditor(Object.class, new DefaultCellEditor(tf));
    myTest myModel = new myTest();
    table.setModel(myModel);
    myModel.insertRow(0,new Object[] {"","","","",""});
    myModel.insertRow(0,new Object[] {"","","","",""});
    myModel.insertRow(0,new Object[] {"","","","",""});
    myModel.insertRow(0,new Object[] {"","","","",""});
    myModel.insertRow(0,new Object[] {"","","","",""});
    JFrame frame = new JFrame();
    frame.getContentPane().add(new JScrollPane(table));
    frame.setSize(400, 300);
    frame.setVisible(true);
    When you place the cursor in the first cell, first line, enter some text, automatically in row1, col 4 appears 'nothing'. and that's it. but from the source-code it should display as well in row 5, col3 'Sum' which isn't. It is only displayed, when I move the selection to the last line.
    Anybody has idea, how to update the display of JTable properly to see both values? I guess it is only the first fireTableChanged processed, the second is ignored.

    Use the "code" formatting tags when posting code to it retains its original formatting.
    Maybe this posting does what you want:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=566133

Maybe you are looking for

  • Applescript running at a specific time of day

    I have a headless server. If it fails to shut down I want to run script that would force it to shut down. The shut down script I have. tell application "System Events" shut down end tell or if needed do shell script "shutdown -h now" password "YourAd

  • Custom Order Data Workflow

    I am trying to get a comprehensive export of all my Order data (from Adobe Business Catalyst to CSV) to facilitate offline transactions with with my client's fulfillment vendor. Several issues are popping up and I wanted to know my options for each.

  • Download Integration Option for Microsoft SharePoint

    From where can I download Integration Option for Microsoft SharePoinnt for SAP BI 4.1? Or is it the same as for BI 4.0? Thanks.

  • Safari 3 (Leopard), Proxy and CPANEL access = crash

    Just downright strange.. I host a few sites on a shared linux server with cpanel/whm as the site management platform... Updated to Leopard and now if I access the cpanel through a proxy server, Safari Crashes.. If I access the same sites without goin

  • How do I download microsoft office if i already have it on my pc

    I already have Microsoft Office 2010 on my home PC, how do I take the Product ID and download Office on my macbook pro?