/** * Paint one List cell: compute the relevant state, get the "rubber stamp" * cell renderer component, and then use the CellRendererPane to paint it. * Subclasses may want to override this method rather than paint(). * * @see #paint */ private void paintCell(Graphics g, int index) { Object value = getModel().getElementAt(index); boolean cellHasFocus = hasFocus() && (index == getSelectionModel().getLeadSelectionIndex()); boolean isSelected = getSelectionModel().isSelectedIndex(index); Component renderer = getCellRenderer().getListCellRendererComponent( this, value, index, isSelected, cellHasFocus ); renderer.setSize(fixedCellWidth, fixedCellHeight); renderer.paint(g); }
@Override protected Point getFocusedCell() { int leadRow = component.getSelectionModel().getLeadSelectionIndex(); int leadColumn = component.getColumnModel().getSelectionModel() .getLeadSelectionIndex(); return new Point(leadColumn, leadRow); }
@Override protected Point getFocusedCell() { int leadRow = component.getSelectionModel().getLeadSelectionIndex(); int leadColumn = component.getColumnModel().getSelectionModel() .getLeadSelectionIndex(); return new Point(leadColumn, leadRow); }
@Override protected Point getFocusedCell() { int leadRow = component.getSelectionModel().getLeadSelectionIndex(); int leadColumn = component.getColumnModel().getSelectionModel() .getLeadSelectionIndex(); return new Point(leadColumn, leadRow); }
public int getFocusedRow(){ synchronized(this){ JTable tbl = getTable(); if( tbl==null )return -1; return tbl.getSelectionModel().getLeadSelectionIndex(); } } //</editor-fold>
@Override public void valueChanged(ListSelectionEvent lse) { int curFocusedRow = listSelModel.getLeadSelectionIndex(); if( curFocusedRow!=focusedRow ){ int oldFocRow = focusedRow; focusedRow = curFocusedRow; onFocusedRowChanged(table, oldFocRow, focusedRow); } } };
public void valueChanged(ListSelectionEvent event) { if (event.getValueIsAdjusting()) { return; } itsRow = table.getSelectionModel().getLeadSelectionIndex(); table.repaint(); checkTranscription(); } }
private void openResult(InputEvent e) { JTable table = (JTable) e.getSource(); Integer selectedLine = table.getSelectionModel().getLeadSelectionIndex(); FindAction.jumpToResult(searchResults.get(selectedLine)); }
private static Object getSelectedElement(JTable table) { assert table != null; // PENDING(shannonh) - more cases to consider int index = table.getSelectionModel().getLeadSelectionIndex(); index = table.getSelectionModel().isSelectedIndex(index) ? index : table.getSelectionModel() .getMinSelectionIndex(); if (index == -1) { return null; } return getElement(table, index); }
private static Object getSelectedElement(JTable table) { assert table != null; // PENDING(shannonh) - more cases to consider int index = table.getSelectionModel().getLeadSelectionIndex(); index = table.getSelectionModel().isSelectedIndex(index) ? index : table.getSelectionModel().getMinSelectionIndex(); if (index == -1) { return null; } return getElement(table, index); }
/** * {@inheritDoc} */ @Override public boolean hasFocus() { boolean rowIsLead = (table.getSelectionModel() .getLeadSelectionIndex() == row); boolean colIsLead = (table.getColumnModel().getSelectionModel() .getLeadSelectionIndex() == column); return table.isFocusOwner() && (rowIsLead && colIsLead); }
public void valueChanged(final ListSelectionEvent _e) { final ListSelectionModel rowModel = table_.getSelectionModel(); if (rowModel.isSelectionEmpty()) { ch_.setColor(null); } final int row = rowModel.getLeadSelectionIndex(); final int col = table_.getColumnModel().getSelectionModel().getLeadSelectionIndex(); final Color c = model_.getColor(row, col); ch_.setColor(c); }
public void onKeyPressedOnSelectedList(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DELETE) { int lastIndice = ui.getSelectedList().getSelectionModel().getLeadSelectionIndex(); unselect(); JList source = (JList) e.getSource(); if (source.getModel().getSize() > 0) { source.setSelectedIndex(Math.min(lastIndice, source.getModel().getSize() - 1)); ui.getSelectedList().requestFocus(); } } }
private void cacheModelSelection(RowSorterEvent sortEvent) { lastModelSelection = convertSelectionToModel(sortEvent); modelLeadIndex = convertRowIndexToModel(sortEvent, getViewSelectionModel().getLeadSelectionIndex()); }
private void cacheModelSelection(RowSorterEvent sortEvent) { lastModelSelection = convertSelectionToModel(sortEvent); modelLeadIndex = convertRowIndexToModel(sortEvent, getViewSelectionModel().getLeadSelectionIndex()); }
private void cacheModelSelection(RowSorterEvent sortEvent) { lastModelSelection = convertSelectionToModel(sortEvent); modelLeadIndex = convertRowIndexToModel(sortEvent, getViewSelectionModel().getLeadSelectionIndex()); }
private void cacheModelSelection(RowSorterEvent sortEvent) { lastModelSelection = convertSelectionToModel(sortEvent); modelLeadIndex = convertRowIndexToModel(sortEvent, getViewSelectionModel().getLeadSelectionIndex()); }
public void valueChanged(final ListSelectionEvent _e) { final boolean empty = common_.isSelectionEmpty(); final int idx = empty ? -1 : common_.getLeadSelectionIndex(); for (int i = targets_.length - 1; i >= 0; i--) { if (empty) { targets_[i].getTimeListSelectionModel().clearSelection(); } else { targets_[i].getTimeListSelectionModel().setSelectionInterval(idx, idx); } } }
private static Object getSelectedElement(JList list) { assert list != null; // PENDING(shannonh) - more cases to consider int index = list.getSelectionModel().getLeadSelectionIndex(); index = list.getSelectionModel().isSelectedIndex(index) ? index : list.getSelectionModel() .getMinSelectionIndex(); if (index == -1) { return null; } return getElement(list, index); }
private static Object getSelectedElement(JList list) { assert list != null; // PENDING(shannonh) - more cases to consider int index = list.getSelectionModel().getLeadSelectionIndex(); index = list.getSelectionModel().isSelectedIndex(index) ? index : list.getSelectionModel().getMinSelectionIndex(); if (index == -1) { return null; } return getElement(list, index); }