Questions tagged [treecellrenderer]

TreeCellRenderer is a Java Swing interface that defines the method required by any object that would like to be a renderer for cells in a JTable.

TreeCellRenderer is a Java Swing interface that defines the method required by any object that would like to be a renderer for cells in a JTable.

The interface defines only one method, getTreeCellRendererComponent, that takes the value to be rendered and various additional information (selected, focused, is a leaf, etc). The method must return an instance of Component that is positioned at the tree cell location, later calling paint() on it. It is not uncommon to derive the renderer itself from a component and return this.

51 questions
1
vote
1 answer

Change The icon of a certain Node in JTree?

I have a JTree and nodes of it are driven from DefaultMutableTreeNode. Each node can be verify or not.At first the icon of all nodes are the same but, I am going to change the ICON of the verified nodes when I select them and press the verify…
Sal-laS
  • 11,016
  • 25
  • 99
  • 169
1
vote
3 answers

Strange DefaultTreeCellRenderer behaviour, only partially executing getTreeCellRendererComponent()

I created a JTree, even with multiple root nodes (what was quite hard for me, as it's my first JTree), and was ready (I thought) to go one step further; a cellrenderer. I tried to set one icon for every node, it worked fine. Now I'm trying to check…
11684
  • 7,356
  • 12
  • 48
  • 71
0
votes
1 answer

Issue with Swing JTree Checkbox Behavior

Facing this issue with my code while working with checkboxes in a JTree. The root node is treated as a "Named Vector" in first iteration instead of a "CheckBoxNode"As a result, it doesn't iterate through its child checkboxes. In the second…
JamesB
  • 569
  • 1
  • 9
  • 31
0
votes
0 answers

JTree Node as Checkbox is unclickable

I'm currently facing a challenge with my JTree implementation, and I'm seeking to find a solution. The JTree displays a hierarchical structure with nodes and checkboxes, and I want to make the root node selectable as a Checkbox. Checkboxes in the…
JamesB
  • 569
  • 1
  • 9
  • 31
0
votes
1 answer

I already have a checkbox in a Java Swing TreeNode. But how do I make it checkable?

Note: I am NOT asking how to put a checkbox in a JTree - previously, a confused moderator thought this is what I was asking. I already have the checkbox in the tree. I am asking what class or method controls the checkability of the checkbox... In…
john smith
  • 619
  • 1
  • 9
  • 15
0
votes
1 answer

Incorrect label width in TreeCellRenderer

I got a JTree with a custom TreeCellRenderer. This renderer is a panel containing a checkbox and a label. While the text of the label is fixed for each node (specified in the UserObject of the DefaultMutableTreeNode), this text may or may not be…
Robert Kock
  • 5,795
  • 1
  • 12
  • 20
0
votes
1 answer

How to modify javax.swing.TreeCellRenderer in order to stroke the text in the cell

Does anybody know how a javax.swing.TreeCellRenderer should be modified in order to stroke the text in the cell?
Ivajlo Iliev
  • 303
  • 1
  • 3
  • 19
0
votes
0 answers

How to reduce the background colour length of a node in Jtree?

Basically am setting a background color for the selected component/node in the Jtree. But the problem is the background color length is exceeding the length of the node text. So can anybody tell on how to control the length of the background color?…
user2706780
0
votes
0 answers

Changing JTree Node Icon dynamically

I have implemented a JTree using the DefaultTreeModel.I am storing Message type objects in the tree where I set the node icons initially according to a direction variable value of the Message. I can do this successfully using the below code. …
sher17
  • 607
  • 1
  • 12
  • 31
0
votes
0 answers

How can change font to JXteeTable for particular row

I have a JXtreeTable in my java swing application. I want to set a customize cellrenderer, so I want to have a custom font for the row parent and I want to set another custom font for the child node (lead node), but I'm not able to du this. This is…
bircastri
  • 2,169
  • 13
  • 50
  • 119
0
votes
1 answer

How can set Font and Background color at child node of JXTreeTable

I have a simple Java swing application. So I have a JPanel with a JXTreeTable. I can insert into this TreeTable, soma row with child node, this is ok. Now if I try to run my application, I can see this: Also this is ok. So, now if I try to exapand…
bircastri
  • 2,169
  • 13
  • 50
  • 119
0
votes
2 answers

Strikethrough a node in a JTree

In my project i have a Jtree with custom node (which extends DefaultMutableTreeNode). Each node is associated with a boolean value. When the boolean is False i woul like to strike the texte of my node. So for example : node 1 node1.1 …
scoob27
  • 91
  • 6
0
votes
1 answer

JTree Custom TreeCellRenderer / Selected node-specific color

i am trying to set a different background color for different nodes of a JTree . The user can right click on a node, push a button and choose a color from a JColorChooser . I made a custom treecellrenderer(Chromatizer()) and overriden the method…
Andreas
  • 1
  • 2
0
votes
1 answer

How to call DefaultTreeCellRenderer for specific nodes in the JTree

I have a customized DefaultTreeCellRenderer that disables nodes in the JTree. Here is its code: static class CustomDefaultTreeCellRenderer extends DefaultTreeCellRenderer{ @Override public Component getTreeCellRendererComponent(JTree…
Dan
  • 577
  • 1
  • 12
  • 38
0
votes
1 answer

Updating Rendered Tree Cells

Here is my application. What I want to do is make it so that when the user's details are updated, so does it's node in the JTree. Is this possible; even though the JTree and it's rendered cells have already been created? I need an example of…
Kurtiss
  • 495
  • 2
  • 7
  • 22