Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4339486
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:13:22+00:00 2026-05-21T11:13:22+00:00

I create a Jtree that all of its nodes have User object, I fill

  • 0

I create a Jtree that all of its nodes have User object, I fill user object by ItemInfo class, now my problem is with renaming a node. I can edit my node but since I try to find my UserObject I saw when I press F2 and rename my node, new name place in my UserObject!

So now I want to know I should touch where to replace new name of my node with previous name manually?

I guess I need to write my own DefaultTreeCellRenderer class, please advice me… (if yes any example for my reference)

public class ItemInfo {
    public String Name;
    public String Value;
    public long ValueID;


    public ItemInfo(String Name, String Value) {
        this.Name = Name;
        this.Value = Value;
    }

    public ItemInfo(String Name, long ValueID) {
        this.Name = Name;
        this.ValueID = ValueID;
    }

    public String toString() {
        return Name;
    }

    public String getValue() {
        return Value;
    }

    public long getValueID() {
        return ValueID;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:13:23+00:00Added an answer on May 21, 2026 at 11:13 am

    Do you add TreeModelListener as described in this tutorial? In the listener you can be notified if a node was changed and update its user object.

    EDIT: See DefaultTreeModel.valueForPathChanged javadoc:

    This sets the user object of the
    TreeNode identified by path and posts
    a node changed. If you use custom user
    objects in the TreeModel you’re going
    to need to subclass this and set the
    user object of the changed node to
    something meaningful.

    Override this method and update your object with new node name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create new ASP.NET web application that use SMTP to send message. The problem
I have a JTree implementation for directories in the file system. The problem I
Alright, so heres my problem: I have an application I am working with that
I have a wizard with several screens where user has to fill his/her details
To create a playlist for all of the music in a folder, I am
I create a new Button object but did not specify the command option upon
I am attempting to modify the standard Swing JTree to intermingle nodes with and
I need a way to create a JTree from a list of Files. How
I have a snippet to create a 'Like' button for our news site: <iframe
I notice in several API's, that you may create a struct which is used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.