jtree

Quick problem with JTable

I've set up my frame with a JTree on the left and a JTable on the right, and used a BorderLayout to accomplish this. However, as soon as I put any data in my JTable, it expands to cover nearly the whole frame, and my JTree with it. The table currently has no data in at all (I'm verifying my SelectionListener), just a couple of column hea...

java swing: add custom graphical button to JTree item

hello, i would like to add an additional button with a small icon to the right of an item in a JTree. can this be done? if so, how? thanks! ...

The best way to pass JTree to applet

I have created a DefaultMutableTree object with application scope in my web app. I'm going to intialise JTree with my object and display the hierarchy using the applet in jsp. I'm not sure how I can pass JTree object to applet. ...

JTree node Rename

Hi Everyone, I am using a JTree and in this to raname a JTree node I am using right click(Rename through popup) or F2 key or double click. But problem is : when I rename a name and hit Enter key, node successfully renamed and when I rename a name and click anywhere on the frame(windows explorer style), node name does not rename. Please ...

java swing vs mvc: is this pattern indeed possible?

Hi, I am new in swing, but managed to create a descend gui. My problem though is that I was not able to apply the patterns suggested in references/tutorials, mainly the MVC pattern. Is it me, or in JTree and using SwingWorker, it is not possible to have a clear separation of controller/view/model? For example I use a Swingworker, but t...

How to Modify the default editing behavior of a TreeCellEditor (Java)

I have a custom object that has a description (String) and priority value (int). I display these values in a JTree because there is a hierarchical relationship between different objects of this type. I only display the description in the JTree nodes because the priority is not important for display purposes. I would like to have a JDial...

JTree from List<File>

Hi there, I need a way to create a JTree from a list of Files. How could I create the Nodes, wich classes and methods should I use? Thanks in advance, JBeginner ...

How do you move nodes in a JTree?

I've got a JTree with a custom model which extends DefaultTreeModel. I need to be able to move a node from one branch to a different branch without losing the selection. Currently, I'm doing it in my model like this: private void moveNode( MutableTreeNode node, MutableTreeNode newParent ) { super.removeNodeFromParent( node ); su...

JTree selected node background being rendered even when setopaque(true)

I have a JTree and I am trying to have a customized look and feel to it, but I am having problems with my cell rendering. Even after writing my own cell renderer, I find that a blue rectangle region marks which cell is selected in the tree, the default for the java look and feel. Any area on the tree that is not painted by the cell rende...

updating JTree in java GUI

Hi all I used a JTree in my GUI and added it to a JFrame. When I want to update it and change it's nodes in another part of my program (while program is running, as an action performed) I try to add new nodes, or remove nodes to it; But my interface doesn't change. Please suggest me a solution. regards ...

Sharing children among parents in a JTree

Hello everyone! I have a custom DefaultMutableTreeNode class that is designed to support robust connections between many types of data attributes (for me those attributes could be strings, user-defined tags, or timestamps). As I aggregate data, I'd like to give the user a live preview of the stored data we've seen so far. For efficiency...

store state/expanded nodes of a jtree for restoring state

Hi, I am working with JTree. I would like to know what is best the way to know which nodes are expanded in a JTree, so as to save its state (i.e. save all expanded paths). So that if I call model.reload() the Jtree would not stay collapsed, but I will be able to restore its original state to the user. I.e. all expanded nodes will be ex...

comparing two TreeNode (or DefaultMutableTreeNode) objects in Java Comparator

Hello everyone! My goal is very simple today, I am trying to work out the proper way to implement compareTo (or the Comparable) interface for my class which extends DefaultMutableTreeNode. The problem is this: Say I have a perfectly good class that represents times. I've already written a perfectly good compareTo method (which works as...

JTree view under High Contrast Mode

Hi, I have one issue related to JTree swing component, I want to use JTree under Windows high contrast Mode, but it never shows tree nodes according to windows High contrast theme. Jtree view Under Normal Mode Jtree view Under High Contrast Mode Eclipse Package Explorer view Under Normal Mode Eclipse Package Explorer view Un...

Tree in scala swing

I want to use a tree in my Scala swing application, but the component isn't available in the API. Does a wrapper of JTree exists ? If not, do you have any advice for making it ? Thanks ...