/** * Returns the height of the cell at the passed in location. */ private int getHeight(int column, int row) { if (column < 0 || column > columnCount || row < 0) { return -1; } if (layoutOrientation != JList.VERTICAL) { return cellHeight; } if (row >= getElementCount()) { return -1; } return (cellHeights == null) ? cellHeight : ((row < cellHeights.length) ? cellHeights[row] : -1); }
/** * Returns the height of the cell at the passed in location. */ private int getHeight(int column, int row) { if (column < 0 || column > columnCount || row < 0) { return -1; } if (layoutOrientation != JList.VERTICAL) { return cellHeight; } if (row >= getElementCount()) { return -1; } return (cellHeights == null) ? cellHeight : ((row < cellHeights.length) ? cellHeights[row] : -1); }
/** * Returns the height of the cell at the passed in location. */ private int getHeight(int column, int row) { if (column < 0 || column > columnCount || row < 0) { return -1; } if (layoutOrientation != JList.VERTICAL) { return cellHeight; } if (row >= getElementCount()) { return -1; } return (cellHeights == null) ? cellHeight : ((row < cellHeights.length) ? cellHeights[row] : -1); }
/** * Returns the height of the cell at the passed in location. */ private int getHeight(int column, int row) { if (column < 0 || column > columnCount || row < 0) { return -1; } if (layoutOrientation != JList.VERTICAL) { return cellHeight; } if (row >= getElementCount()) { return -1; } return (cellHeights == null) ? cellHeight : ((row < cellHeights.length) ? cellHeights[row] : -1); }
/** * Returns the row that the model index <code>index</code> will be * displayed in.. */ private int convertModelToRow(int index) { int size = getElementCount(); if ((index < 0) || (index >= size)) { return -1; } if (layoutOrientation != JList.VERTICAL && columnCount > 1 && rowsPerColumn > 0) { if (layoutOrientation == JList.VERTICAL_WRAP) { return index % rowsPerColumn; } return index / columnCount; } return index; }
/** * Returns the column that the model index <code>index</code> will be * displayed in. */ private int convertModelToColumn(int index) { int size = getElementCount(); if ((index < 0) || (index >= size)) { return -1; } if (layoutOrientation != JList.VERTICAL && rowsPerColumn > 0 && columnCount > 1) { if (layoutOrientation == JList.VERTICAL_WRAP) { return index / rowsPerColumn; } return index % columnCount; } return 0; }
/** * Returns the row that the model index <code>index</code> will be * displayed in.. */ private int convertModelToRow(int index) { int size = getElementCount(); if ((index < 0) || (index >= size)) { return -1; } if (layoutOrientation != JList.VERTICAL && columnCount > 1 && rowsPerColumn > 0) { if (layoutOrientation == JList.VERTICAL_WRAP) { return index % rowsPerColumn; } return index / columnCount; } return index; }
/** * Returns the column that the model index <code>index</code> will be * displayed in. */ private int convertModelToColumn(int index) { int size = getElementCount(); if ((index < 0) || (index >= size)) { return -1; } if (layoutOrientation != JList.VERTICAL && rowsPerColumn > 0 && columnCount > 1) { if (layoutOrientation == JList.VERTICAL_WRAP) { return index / rowsPerColumn; } return index % columnCount; } return 0; }
/** * Returns the model index for the specified display location. * If <code>column</code>x<code>row</code> is beyond the length of the * model, this will return the model size - 1. */ private int getModelIndex(int column, int row) { switch (layoutOrientation) { case JList.VERTICAL_WRAP: return Math.min(getElementCount() - 1, rowsPerColumn * column + Math.min(row, rowsPerColumn-1)); case JList.HORIZONTAL_WRAP: return Math.min(getElementCount() - 1, row * columnCount + column); default: return row; } }
/** * Returns the model index for the specified display location. * If <code>column</code>x<code>row</code> is beyond the length of the * model, this will return the model size - 1. */ private int getModelIndex(int column, int row) { switch (layoutOrientation) { case JList.VERTICAL_WRAP: return Math.min(getElementCount() - 1, rowsPerColumn * column + Math.min(row, rowsPerColumn-1)); case JList.HORIZONTAL_WRAP: return Math.min(getElementCount() - 1, row * columnCount + column); default: return row; } }
/** * Returns the model index for the specified display location. * If <code>column</code>x<code>row</code> is beyond the length of the * model, this will return the model size - 1. */ private int getModelIndex(int column, int row) { switch (layoutOrientation) { case JList.VERTICAL_WRAP: return Math.min(getElementCount() - 1, rowsPerColumn * column + Math.min(row, rowsPerColumn-1)); case JList.HORIZONTAL_WRAP: return Math.min(getElementCount() - 1, row * columnCount + column); default: return row; } }
/** * Returns the model index for the specified display location. * If <code>column</code>x<code>row</code> is beyond the length of the * model, this will return the model size - 1. */ private int getModelIndex(int column, int row) { switch (layoutOrientation) { case JList.VERTICAL_WRAP: return Math.min(getElementCount() - 1, rowsPerColumn * column + Math.min(row, rowsPerColumn-1)); case JList.HORIZONTAL_WRAP: return Math.min(getElementCount() - 1, row * columnCount + column); default: return row; } }
public void valueChanged(ListSelectionEvent e) { maybeUpdateLayoutState(); int size = getElementCount(); int firstIndex = Math.min(size - 1, Math.max(e.getFirstIndex(), 0)); int lastIndex = Math.min(size - 1, Math.max(e.getLastIndex(), 0)); Rectangle bounds = getCellBounds(list, firstIndex, lastIndex); if (bounds != null) { list.repaint(bounds.x, bounds.y, bounds.width, bounds.height); } }
public void valueChanged(ListSelectionEvent e) { maybeUpdateLayoutState(); int size = getElementCount(); int firstIndex = Math.min(size - 1, Math.max(e.getFirstIndex(), 0)); int lastIndex = Math.min(size - 1, Math.max(e.getLastIndex(), 0)); Rectangle bounds = getCellBounds(list, firstIndex, lastIndex); if (bounds != null) { list.repaint(bounds.x, bounds.y, bounds.width, bounds.height); } }
public void valueChanged(ListSelectionEvent e) { maybeUpdateLayoutState(); int size = getElementCount(); int firstIndex = Math.min(size - 1, Math.max(e.getFirstIndex(), 0)); int lastIndex = Math.min(size - 1, Math.max(e.getLastIndex(), 0)); Rectangle bounds = getCellBounds(list, firstIndex, lastIndex); if (bounds != null) { list.repaint(bounds.x, bounds.y, bounds.width, bounds.height); } }
public void valueChanged(ListSelectionEvent e) { maybeUpdateLayoutState(); int size = getElementCount(); int firstIndex = Math.min(size - 1, Math.max(e.getFirstIndex(), 0)); int lastIndex = Math.min(size - 1, Math.max(e.getLastIndex(), 0)); Rectangle bounds = getCellBounds(list, firstIndex, lastIndex); if (bounds != null) { list.repaint(bounds.x, bounds.y, bounds.width, bounds.height); } }
/** * Selected the previous row and force it to be visible. * * @see JList#ensureIndexIsVisible */ protected void selectNextIndex() { int s = list.getSelectedIndex(); if((s + 1) < getElementCount()) { s += 1; list.setSelectedIndex(s); list.ensureIndexIsVisible(s); } }
/** * Selected the previous row and force it to be visible. * * @see JList#ensureIndexIsVisible */ protected void selectNextIndex() { int s = list.getSelectedIndex(); if((s + 1) < getElementCount()) { s += 1; list.setSelectedIndex(s); list.ensureIndexIsVisible(s); } }
/** * Selected the previous row and force it to be visible. * * @see JList#ensureIndexIsVisible */ protected void selectNextIndex() { int s = list.getSelectedIndex(); if((s + 1) < getElementCount()) { s += 1; list.setSelectedIndex(s); list.ensureIndexIsVisible(s); } }
/** * Selected the previous row and force it to be visible. * * @see JList#ensureIndexIsVisible */ protected void selectNextIndex() { int s = list.getSelectedIndex(); if((s + 1) < getElementCount()) { s += 1; list.setSelectedIndex(s); list.ensureIndexIsVisible(s); } }