I create a treetable using JXTreeTabble , and I want to disable / manage the menu items depending on the value selected. So, I tried to put this code in my table model :
public Object getValueAt(int index) { if (index >= 0 && index < root.getSize()){ return root.get(index); } return null; }
Problem
The above only works if the contents of table not expanded. Since the index for the selected row can be larger than size t able model (the model can have two elements, and the row can have 10 when everything is expanded). In addition, the object type parent is different from children (think of a book with chapters as its children).
What would you suggest as a way to do this correctly?
source share