Questions tagged [treemodel]

109 questions
2
votes
1 answer

How to Stop JTree from collapsing after removing a node from the tree

I'm making a JTree and I have a button that removes a node from the tree. Everytime I removde the node with the button, the Tree automatically collapse. I've read that it's becasue I'm using .reload(). I've also read some SO answers that suggested…
Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
2
votes
1 answer

Which function can be used to select an item in a tree view with Qt?

Which function can be used to select an item in a tree view (or model) with Qt? I even don't know the function is in tree view or model. How to do it? Any function like select(const QModelIndex & index)? Thanks.
user1899020
  • 13,167
  • 21
  • 79
  • 154
2
votes
1 answer

Create non-selectable DefaultTreeModel node with children

I have a DeafultTreeModel tree that has three levels of nodes in it. I want to be able to have the root node and its immediate children node to be non-selectable. Whereas third level of children node should be selectable. Can someone please help me…
Harini J
  • 1
  • 1
  • 1
  • 9
2
votes
1 answer

Highlight the searched node in tree in java swing

m_searchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode node = searchNode(m_searchText.getText()); if (node != null) { TreeNode[] nodes =…
Nikhil
  • 2,857
  • 9
  • 34
  • 58
2
votes
2 answers

Implementing TreeModel

I am trying to write a class that implements the TreeModel class. I was hoping someone could guide me in the right direction. Below is my class. The problem is when I bind it to a jTree Component, the second level keeps being added over and over. So…
PhillyNJ
  • 3,859
  • 4
  • 38
  • 64
1
vote
1 answer

JTree How To Change A Node programmatically?

I'm trying for the first time to use and understand JTrees, TreeModels, TreeModes etc. I want to use a Tree to represent Bluetooth devices in the vicinity of my local device. My Bluetooth device is the Root node of the tree and any FIRST descendents…
D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97
1
vote
2 answers

Updating ImageIcon in JTree without repainting the Tree?

Basically I edit an attribute private string status="OK" in the UserObject() of a DefaultTreeNode(). I have a CustomRenderer which implements DefaultCellRenderer, which sets the Icon by rendering the "OK" attribute of UserObject of a…
KJW
  • 15,035
  • 47
  • 137
  • 243
1
vote
1 answer

Is the GTKMM set_value_vfunc function a lie?

I've been attempting to modify the contents of a custom tree view that inherits from TreeModel and TreeSortable. However, the virtual function set_value_impl contains only an assert. When I tried to look for example implementations, they all quote…
1
vote
1 answer

How to clone a java TreeModel?

I want to have 2 TreeModels: the root of the second TreeModel is a node of the first TreeModel (therefore, the second TreeModel is a subtree of the first TreeModel). I think that I can easily do this by cloning the this TreeModel and changing the…
michelemarcon
  • 23,277
  • 17
  • 52
  • 68
1
vote
1 answer

Java: serverside Persistent storage solution for TableModel and TreeModel?

Scenario: client would logon, create their own TableModel and TreeModels and be able to access it at a later time. TableModel and TreeModel which comprises of Java class objects as well as strings. How would I be able to store this on couchDB? (is…
KJW
  • 15,035
  • 47
  • 137
  • 243
1
vote
1 answer

How to change data of a GtkTreeModel (within "edited" callback)

I'm catching the "edited" signal of my GtkCellRenderer: GtkTreeModel * sortmodel; // contains a sorted model of GtkListStore // ... GtkCellRenderer * renderer; // ... g_object_set(renderer, "editable", TRUE, NULL); g_signal_connect(renderer,…
DarkTrick
  • 2,447
  • 1
  • 21
  • 39
1
vote
1 answer

Convert TreeModel.toString back to TreeModel

I am writing a java PlugIn for a robot, which involves using a dynamic JTree. When the program that uses the PlugIn is closed, and then reopened, any variables and object need to be stored in the robots DataModel. However, I cannot store a JTree in…
Sam Hilton
  • 30
  • 6
1
vote
2 answers

How to use goJs TreeModel in angular 7

I am trying to create a tree model with a set of links and nodes. I have it in my jsfiddle using javascript it works fine. I am trying to replicate the same in angular. I could not find any helpfull info. I am getting the below error when i try to…
HariHaran
  • 3,642
  • 2
  • 16
  • 33
1
vote
0 answers

How about if use GUI class in QT CLI application?

I am developing a Qt CLI application. I know that we should only use the class of CORE lib QT -= gui CONFIG += console But I want to use QStandardItemModel for a tree view (show on console window). How about if I set Qt += gui and include…
kien bui
  • 1,760
  • 2
  • 17
  • 33
1
vote
2 answers

Dynamically create node in lwuit for tree view

TreeModel model = new TreeModel() { Node[] sillyTree = { new Node("X", new Node[] { new Node("Child 1", new Node[] { }), new Node("Child 2", new Node[] { }), new Node("Child 3",…
JohnRaja
  • 2,377
  • 6
  • 26
  • 47