I'm using outline
with netbeans to display some structured data.
How can I map the selected row to an object in a tree?
You will see in the example. It looks like the author, so it should be helpful. Netbusiness 6.8:
Netbins / Platform 11 / module / org-netbeans-swing-outline I have class org.netbeans.swing.outline.Outline
addressThis can be useful. Depending on the example given above, there is a listener that shows a clear change in the row number because the nodes are expanded and collapsed and the selection remains stable:
Settings.Get SelectionModel (). AddListSelectionListener) {@Override Public Zero Value changed (ListSelectionEvent e) {int row = outline.getSelectedRow (); File f = (file) outline .getValueAt (line, 0); If (! E.getValueIsAdjusting ()) {System.out Println (line + ":" + f);}}});
However, you can see the
outline model
andDefaultOutlineModel
. The former applies bothtree modal
andtablesmodel
and providesTreePathSupport
; The latter mentions "impedance mismatch between TableModelAvent and Tree Model Avent".Like
JTable
, the selected row in the view can not match this line in the index model, perhaps sorting etc. ThegetValueAt ()
method seems to be a convenient way to callconvertRowIndexToModel ()
. This is common in swing model model architecture, which "falls and controls parts of every user's component (user interface) object." See.
Comments
Post a Comment