@Override public int getMinSelectionIndex() { return getSelectionModel().getMinSelectionRow(); }
static void previousRow(JTree tree) { int rowCount = tree.getRowCount(); if (rowCount > 0) { int selectedRow = tree.getSelectionModel().getMinSelectionRow(); if (selectedRow == -1) { selectedRow = (rowCount -1); } else { selectedRow--; if (selectedRow < 0) { selectedRow = (rowCount -1); } } tree.setSelectionRow(selectedRow); scrollTreeToSelectedRow(tree); } }
static void nextRow(JTree tree) { int rowCount = tree.getRowCount(); if (rowCount > 0) { int selectedRow = tree.getSelectionModel().getMinSelectionRow(); if (selectedRow == -1) { selectedRow = 0; tree.setSelectionRow(selectedRow); } else { selectedRow++; } tree.setSelectionRow(selectedRow % rowCount); scrollTreeToSelectedRow(tree); } }
private void repaintSelection () { int first = getSelectionModel().getMinSelectionRow(); int last = getSelectionModel().getMaxSelectionRow(); if (first != -1) { if (first == last) { Rectangle r = getRowBounds(first); repaint (r.x,r.y,r.width,r.height); } else { Rectangle top = getRowBounds(first); Rectangle bottom = getRowBounds(last); Rectangle r = new Rectangle(); r.x = Math.min (top.x, bottom.x); r.y = top.y; r.width = getWidth(); r.height = bottom.y + bottom.height - top.y; repaint(r.x,r.y,r.width,r.height); } } }
private void repaintSelection () { int first = getSelectionModel().getMinSelectionRow(); int last = getSelectionModel().getMaxSelectionRow(); if (first != -1) { if (first == last) { Rectangle r = getRowBounds(first); repaint (r.x,r.y,r.width,r.height); } else { Rectangle top = getRowBounds(first); Rectangle bottom = getRowBounds(last); Rectangle r = new Rectangle(); r.x = Math.min (top.x, bottom.x); r.y = top.y; r.width = getWidth(); r.height = bottom.y + bottom.height - top.y; repaint(r.x,r.y,r.width,r.height); } } }
start = row; if (start < row) start = getSelectionModel().getMinSelectionRow(); setSelectionInterval( start,
start = row; if (start < row) start = getSelectionModel().getMinSelectionRow(); setSelectionInterval( start,
private void repaintSelection() { int first = getSelectionModel().getMinSelectionRow(); int last = getSelectionModel().getMaxSelectionRow(); if (first != -1) { if (first == last) { Rectangle r = getRowBounds(first); if (r == null) { repaint(); return; } repaint(r.x, r.y, r.width, r.height); } else { Rectangle top = getRowBounds(first); Rectangle bottom = getRowBounds(last); if (top == null || bottom == null) { repaint(); return; } Rectangle r = new Rectangle(); r.x = Math.min(top.x, bottom.x); r.y = top.y; r.width = getWidth(); r.height = (bottom.y + bottom.height) - top.y; repaint(r.x, r.y, r.width, r.height); } } }
return selectionModel.getMinSelectionRow();