JTree: how to rename or substitute folders/leafs ?

Try to work with JTree …
Tutorial and api description is not really clear.
Could someone tell me:
1. How can I change name of root or any folder/leaf from my program?
2. How can I substitute the whole showed tree or some part of it, without deleting JTree object(since it is visible in my JPanel)?
Thank you very much.

You change the TreeModel which will fire the correct event so the JTree updates automatically.
See DefaultTreeModel insertNodeInto, removeNodeFromParent and valueForPathChanged (note that you need to override this method and call nodeChanged() yourself if your tree nodes don't have String user objects.

Similar Messages

  • JTree Root Folder renaming...

    hi,
    In JTree, how to rename the label of the root folder.
    any help please????

    Try the following:
    String newName = "whatever";
    root = (DefaultMutableTreeNode)treeModel.getRoot();
    root.setUserObject(newName);
    treeModel.reload();
    Hope this helps, Claire

  • Xml in JTree: how to not collpase JTree node, when renaming XML Node.

    Hi.
    I'm writing some kind of XML editor. I want to view my XML document in JTree and make user able to edit contents of XML. I made my own TreeModel for JTree, which straight accesses XML DOM, produced by Xerces. Using DOM Events, I made good-looking JTree updates without collapsing JTree on inserting or removing XML nodes.
    But there is a problem. I need to produce to user some method of renaming nodes. As I know, there is no way to rename node in w3c DOM. So I create new one with new name and copy all children and attributes to it. But in this way I got a new object of XML Node instead of renamed one. And I need to initiate rebuilding (treeStructureChanged event) of JTree structure. Renamed node collapses. If I use treeNodesChanged event (no rebuilding, just changes string view of JTree node), then when I try to operate with renamed node again, exception will be throwed.
    Is there some way to rename nodes in my program without collpasing JTree?
    I'am new to Java. Maybe there is a method in Xerces DOM implementation to rename nodes without recreating?
    Thanks in advance.

    I assume that "rename" means to change the element name? Anyway your question seems to be "When I add a node to a JTree, how do I make sure it is expanded?" This is completely concerned with Swing, so it might have been better to post it in the Swing forum, but if it were me I would do this:
    1. Copy the XML document into a JTree.
    2. Allow the user to edit the document. Don't attempt to keep an XML document or DOM synchronized with the contents of the JTree.
    3. On request of the user, copy the JTree back to a new XML document.
    This way you can "rename" things to the user's heart's content without having the problem you described.

  • How to view all files / folders using a Jtree

    Hello,
    I am developing a 'windows explorer' type application and need to create a JTree which displays all files and folders on a local and remote PC in the same way that windows explorer works.
    Can anyone recommend a good way to read all files / folders and display them in a JTree?
    Thanks in advance!!!!!!

    Can anyone recommend a good way to read all files /
    folders and display them in a JTree? Don't even try to read all the files at once; it could take too long and could consume a lot of memory. Create a JTree model that only reads the children of node when required. I use a simple cache (I hate using a cache but in this case it is needed) to minimise the number of disk reads but I use a TreeExpansionListener to remove items from the cache when a node is about to be collapsed e.g.
        public void treeWillCollapse(TreeExpansionEvent event)
            Object lastElement = event.getPath().getLastPathComponent();
            childCache_.remove(lastElement);
        }

  • 10g -  how to rename the dashboard

    hi, experts, how to rename the dashboard?
    do we need to reset security after the rename?

    Hi,
    1) Log into presentation service with Administrator, go to Settings > Administration > Manage Presentation Catalog.
    2) It opens a window; in this window you find option Show Hidden Items. Select this check box.
    3) Now you will be able to Navigate to the Shared Folders and the group folder under which you have created the dashboard.
    4) Select _Portal folder (this will only appear when you select Show Hidden Items options)
    5) It displays the list of dashboards under this folder. Now select Rename option corresponding to the dashboard that you want to rename.

  • Renaming iPhoto album folders

    I just found out I committed the cardinal sin of renaming iPhoto album folders while in Finder. Of course now nothing shows up in iPhoto app except empty shells of what used to be my photos. All the original photo file names are still the same, I only changed the folder names that they reside in. Is there something I can do to re-access all my photos in the library?

    David,
    You could rename the folders back to their original name. How large is your library and how many changes did you make? Folders are named year/month/date, all in numbers such as 2005/09/13. You can look a a few photos in each folder and determine the proper naming scheme. If you have a large library, this could be quite an effort. If you moved files around after renaming the folders, you are in for an even bigger task and one that may not be realistic to get right.
    You could also extract your photos using iPhoto Extractor and then re-import the photos into a new iPhoto Library.
    Hope this helped!
    Sam

  • On my computer I have folders in my email accounts but they are not on my iPad when I go into mail how do I get my folders in my iPad?

    On my computer I have folders in my email accounts but they are not on my iPad when I go into mail how do I get my folders in my iPad?

    https://buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/offerOptOut

  • How to rename a column name in a table? Thanks first!

    I tried to drop a column age from table student by writing the
    following in the sql plus environment as :
    SQL> alter table student drop column age ;
    but I found the following error
    ORA-00905: 缺少关键字 (Lack of Key word)
    I have oracle enterprise edition 8.0.5 installed at windows 2000
    thank you
    And I want to know how to rename a column name in a table?
    thanks

    In Oracle 8i, your syntax would have worked.  However, if I
    recall correctly, in Oracle 8.0, you can't rename or drop a
    column directly.  One way to get around that problem is to
    create another table based on a select statement from your
    original table, providing the new column name as an alias if you
    want to change the column name, or omitting that column from the
    select statement if you just want to drop it.  Then drop the
    original table.  Then re-create the original table based on a
    select statement from the other table.  Then you can drop the
    other table.  Here is an example:
    CREATE TABLE temporary_table_name
    AS
    SELECT age AS new_column_name,
           other_columns
    FROM   student
    DROP TABLE student
    CREATE TABLE student
    AS
    SELECT *
    FROM   temporary_table_name
    DROP TABLE temporary_table_name
    Something that you need to consider before doing this is
    dependencies.  You need to make a list of all your dependecies
    before you do this, so that you can re-create them afterwards. 
    If there are a lot of them, it might be worthwhile to do
    something else, like creating a view with an alias for the
    column or just providing an alias in a select.  It depends on
    what you need the different column name for.

  • How to Rename a Topic ID in Map File to Avoid Conflict with Another Program?

    Robo 8 HTML:
    Can somebody assist me in understanding how to rename a topic ID in my map.h file?
    An application programmer informs me there are nine topic IDs (shown below) in my project map file which conflict with predefined names of constants/functions from the Visual Studio Libs program and, is requesting I change the names of the topics listed below to resolve topic ID conflict in order to enable F1 call for these topics.
    #define Open    59
    #define Save    60
    #define Print   63
    #define Cut     72
    #define Copy    73
    #define Paste   74
    #define Clear   75
    #define Status  81
    #define Substructure  139
    Can I simply alter the topic names and retain their associated map numbers in <Create/Edit Map ID> dialog to resolve the map file conflict with Visual Studio Libs program functions? Or, is there more work involved in changing a topic name in a map.h file?
    Any assistance with this question is greatly appreciated.
    Thanks,
    robert

    Hi,
    Simply renaming the TopicID's in the .h file won't work. The TopicID is used in the alias file (projectname.ali) to link a map number with a topic. Also, you can use either TopicID's or map numbers to call the help. (Using TopicID's only works for WebHelp afaik.)
    If you use map numbers to call the help, you can rename the TopicID using the mentioned dialog. No problem.
    If you want to change the ID from the files, you have to change both the .h file as the .ali file. No changes to topics needed.

  • How to rename a macbook pro 13 inch 10.7.3 version

    how to rename a macbook pro 13 inch 10.7.3 version?

    As for the Users...
    Go to system preferences - users and groups - click the plus sign - add the name you want.
    Restart your MB - login with your username.
    go back to users and groups - highlight your uncles name - click the minus sign.

  • How can I add multiple folders to iTunes with Windows 8?

    I have windows 8 and the latest version of iTunes on Windows 8. How can I put multiple folders of music onto iTunes

    Enable the menu bar with Ctrl+B. Then use File > Add Folder to Library.
    tt2

  • Can't figure out how to rename css style in mx

    Hello,
    I can't figure out how to rename css style in mx. I have the
    style selected in the proprety inspector. Is there supposed to be a
    rename option at the bottom of the same dropdown box? There is
    option to edit style and a few others in same dropdown box... but
    no rename option. Please be specific... I have looked it up on the
    internet... but still cant find the option.
    Thanks,
    PoJ

    Do a Find and Replace to find name1 and replace with name2.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "computerpain" <[email protected]> wrote in
    message
    news:ed43p3$m9h$[email protected]..
    > Hello,
    > I can't figure out how to rename css style in mx. I have
    the style
    > selected
    > in the proprety inspector. Is there supposed to be a
    rename option at the
    > bottom of the same dropdown box? There is option to edit
    style and a few
    > others in same dropdown box... but no rename option.
    Please be
    > specific... I
    > have looked it up on the internet... but still cant find
    the option.
    >
    > Thanks,
    > PoJ
    >

  • How do I move multiple folders to  a new location

    I'm tring to reorganize after a computer crash. How do I move multiple folders to  a new location?

    In the Organizer you can switch to Folder Location View by clicking the Display button (near top right)
    You can then expand he folder tree in the left hand pane and drag and drop.

  • My webhost had me delete my TBird account, and create a new account. How do I get my folders & files from my Hardrive back to TB? THANKS!

    My webhost had me delete my ThunderBird POP3 account, and create a new ThunderBird IMAP account.
    This took all my folders and files out of Thunderbird!!!
    I know where all my folders and files are located on my hard drive.
    How do I get my folders & files from my hard drive back to TB?
    Any help will be much appreciated.
    THANKS IN ADVANCE!
    Jeff

    When you delete a Pop mail account, it disappears from the Account Settings and Folder Pane, but fortunately it still exists in the Profile folder unless you had removed it.
    Ideally, you should have moved all the emails into 'Local Folders' before removing the account.
    You could use this addon tool to import messages into 'Local Folders' account.
    '''ImportExportTools: '''
    * https://addons.mozilla.org/en-US/thunderbird/addon/importexporttools/
    Download the .xpi file and save to desktop or Downloads folder.
    '''To install addon:'''
    In Thunderbird
    'Tools' > 'Addons' OR 'Menu icon' > 'Addons'
    * click on the gear wheel icon and select 'Install addon from file'
    * Locate and select the .xpi file you downloaded and click on 'Open'.
    * After installing you will need to restart Thunderbird to activate.
    In 'Local Folders' create some folders with suitable names.
    Right click on folder > ImportExportTools
    There are a couple of Options on importing
    See image below as example aid.

  • How to create a substitute for requester in SRM 7.0

    Hi,
    do you know how to create a substitute for requester?
    we have groups of 2 people and we want that they can see and edit shopping carts one of each other. Do you know how is it possible? it will be necessary for all SCs.
    Thanks.
    Regards,
    Nelson

    You can use the "Team Cart" feature introduced in SRM 7 for your requirement.
    Take a look at this wiki page for more information http://wiki.sdn.sap.com/wiki/display/SRM/Team+purchasing
    Edited by: Jay Yang on Mar 31, 2011 10:47 AM

Maybe you are looking for

  • Error at the time of Production order cancellation.

    Hi PP Gurus, The transactions happened when Sales order costing was activated 1. Sales order created 2. Production order creation, release 3. Production order confirmation and QM lot created 4. QM lot cleared with Result recording and UD has taken 5.

  • TNS Error : ORA-12154 unsing oo4o with VB

    In VB6, using oo4o(Oracle InProc Server), whin I run debuging mode with VB6 App, result is successfull. But, compile this application, and execute EXE module, error occur 'Cannot resolve TNS Name (ORA-12154)'.

  • How to get profile info on when replying?

    When I start a thread, my product/profile info appears, but when I reply to a post, it doesn't. However, I have seen it appear for some posters. How is this done?

  • Notified of Property Changes in a Java Object

    Hi guys, Is there a standard mechanims in java where when an object's properties change value, it being notified to the caller. i am typically refering something similar to listeners which the object concerned implments and when reacts to it when the

  • Samsung SCH-LC11 edit settings file

    Does anyone know how to edit the settings file on a Samsung SCH-LC11.  Specifically I want to allow it to still operate as a hotspot while charging.  I've seen a post on Cnet for a different Samsung hotspot for this.  When I export the settings file