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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:14:22+00:00 2026-06-09T04:14:22+00:00

I have a JTree that I’m filling with skills for a Game Database programme

  • 0

I have a JTree that I’m filling with skills for a Game Database programme that I’m writing.

There are several categories, and subcategories (actual skills), and then levels skill below that (sometimes). Currently I’m emulating this with one skill class, some options inside, and a few enums, plus a method to check that if the skill is a category (called isCategory). Two other things to note:

  1. Different types of skill behave differently.
    Some are bought once, other several times, some have options to pick from etc
  2. Different categories contain different skill.
    For instance The Weapon Skills category has different types of weapons, but the Armour Skills are in a different section.

I’ve seen a very good example of attaching a ComboBox via a cell renderer to each node in the tree. Here is the example I found.

I understand the above code, but I can’t see how to would attach the combo box to a node, and not to the tree? I’ve read ‘How to use Trees‘, and I’ve run, and looked at the code for a few of the demos for tree. I can make basic trees, but I find the tutorials a bit obtuse and lacking in enough detail to figure out for myself how to proceed. I’ve found another example of only rendering leaf nodes as checkboxes, which is much more complex.

Obviously I’d like to combine the two, being able to have different categories able to have different skills and different skills have different levels of proficiency. However the only way I can think of doing so it to have different JComboBoxModels for the different types but I don’t know how to do this, and I can’t find out how. I’ve tried to edit the checkbox example to use ComboBoxes, but for the life of me I can’t figure it out.

Could someone give me a hint as to what approach to take on this, as I’m new to Java and strugglingto figure out what to do?

  • 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-09T04:14:24+00:00Added an answer on June 9, 2026 at 4:14 am

    Would this be a good place to start?

    Conceptually, yes. Both JTable and JTree use the flyweight pattern to render and edit cells/nodes.

    • This example cites a basic TreeCellRenderer.
    • This example illustrates a simple TreeCellEditor using the default renderer.
    • This example shows an Outline view that incorporates features of both JTable and JTree.

    image

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

Sidebar

Related Questions

I have a JTree populated with some (custom) nodes. I have a class that's
I have a JTree which I give objects that implement the TreeNode interface, and
I have a JTree and the Nodes are a abstract class (Item) that extends
I am writing this application in Java, where I have a JTree on the
I have a simple Jython GUI that displays an XML file in a JTree.
I have created a custom JTree. That tree could be filtered to show only
I have a Jtree with nodes representing images that the user can call up
I create a Jtree that all of its nodes have User object, I fill
I want to have a JTree in my swing application that does not have
I have a JTree that implements multi selection logic. This works great when I

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.