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 8145747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:45:46+00:00 2026-06-06T13:45:46+00:00

Okay, I’m very new to Java so please bear with me. I am using

  • 0

Okay, I’m very new to Java so please bear with me.

I am using Netbeans 6.8 to write a small desktop application that includes a JTree component, and my requirement is that I be able to save and load the tree structure, but that the structure allows for three items of information per tree node – The text to be displayed as the node, a unique identifier, and a file name.

Of course I would also need to be able to get all three bits of information when a node is clicked.

I have successfully saved the and loaded the tree model using getModel() and XMLDecoder/encoder, but this of course only saves the default tree model.

I have followed several tutorials on creating a custom tree model but I have found them confusing, and I have been unable to transfer what they were telling me into my own project, since of course they usually create an entire example application in one go.

Assuming that a tree model like this is even possible please could someone explain how to go about creating such a model, and most importantly, how to place the model into a JTree that already exists in the application (and how I would go about retrieving the information when a node is clicked – I can currently find the selected node and retrieve its text)

If this is not possible Id gladly hear any alternative methods that result in the same functionality.

A solution has been reached so thanks to everyone for their efforts, however the correct answer must go to Andrew for posting it first!

For those interested:
I used the Netbeans IDE to create a new Javabean object. Once I realised the difference between this and a normal object I managed to place a newly created Javabean object into a tree node. Just to make it all good, my original method of saving still works fine!

thanks for your efforts everyone.

MVK

  • 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-06-06T13:45:47+00:00Added an answer on June 6, 2026 at 1:45 pm

    The text to be displayed as the node, a unique identifier, and a file name.

    Encapsualte them in a JavaBean Object and use an appropriate renderer.

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

Sidebar

Related Questions

Okay, so I know that using eval() isn't great, but I haven't been able
Okay, before you guys go nuts -- this is just a small site, temporary
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay, so I'm trying to make a game that uses this algorithm: http://www.codeproject.com/Articles/15573/2D-Polygon-Collision-Detection But
Okay I have created an application where in one of the screens I have
Okay, I have hundreds of .net controls with text attributes that needs to be
Okay, I'm reading about Linux kernel development and there are some code snippets using
Okay so what I have is a table that keeps track of history on
Okay, so I'm running a small test webserver on my private network. I've got
Okay, here's the scenario. I have a utility that processes tons of records, and

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.