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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:16:46+00:00 2026-05-31T19:16:46+00:00

Short explanation of my problem, I need to parse an object and put its

  • 0

Short explanation of my problem, I need to parse an object and put its content into a JTree. I know the object can have fields of primitive types, but also other objects. How can I achieve that parsing, is reflection something I should use? I have no clue right now.

The structure would look something like that:

-object1
    |
    fieldname1 = 1256
    |
    fieldname2 = 5623
    |
    object2
    |  |
    |  fieldname1 = 154
    |  |
    |  fieldname2 = 190
    |
    object3
       | 

Any help would be appreciated. Thanks in advance!

  • 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-31T19:16:48+00:00Added an answer on May 31, 2026 at 7:16 pm

    Yes, you should use Reflection API to discover object fields, and fill the JTree node values.

    Recursively process each object as follows:

    • add a node to the tree
    • process objects from fields declared in your object’s class (using Class.getDeclaredFields())
    • process objects from fields in each superclass of your object (Class.getDeclaredFields() doesn’t return inherited fields)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short Explanation Currently I have a UITableView which contains cells of videos from a
I have read over this which sort of gives an explanation of when you'd
I have a problem with what appears to be some sort of implicit casting
I have a problem in my MATLAB code. Let me first give you some
Short Version: Does anyone know how to do a simple date insert using Doctrine2?
I have a Set object and I use this set to ensure that when
I have a huge array of ints that I need to sort. The catch
i have the following problem. The 1st step is to implement a program, which
Does anyone have any good references for equations which can be implemented relatively easily
I am running into the following problem with gzip.exe, be it from UnxUtils or

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.