Java Code Examples for javax.swing.JTable#setRowSelectionInterval()
The following examples show how to use
javax.swing.JTable#setRowSelectionInterval() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HealthTabRt.java From FoxTelem with GNU General Public License v3.0 | 6 votes |
@Override protected void displayRow(JTable rtTable, int fromRow, int row) { long reset_l = (long) rtTable.getValueAt(row, HealthTableModel.RESET_COL); long uptime = (long)rtTable.getValueAt(row, HealthTableModel.UPTIME_COL); //Log.println("RESET: " + reset); //Log.println("UPTIME: " + uptime); int reset = (int)reset_l; maxPayload = Config.payloadStore.getFramePart(foxId, reset, uptime, Spacecraft.MAX_LAYOUT, true); if (maxPayload != null) updateTabMax(maxPayload); minPayload = Config.payloadStore.getFramePart(foxId, reset, uptime, Spacecraft.MIN_LAYOUT, true); if (minPayload != null) updateTabMin(minPayload); realTime = Config.payloadStore.getFramePart(foxId, reset, uptime, Spacecraft.REAL_TIME_LAYOUT, false); if (realTime != null) updateTabRT(realTime, false); if (fromRow == NO_ROW_SELECTED) fromRow = row; if (fromRow <= row) rtTable.setRowSelectionInterval(fromRow, row); else rtTable.setRowSelectionInterval(row, fromRow); }
Example 2
Source File: QueryBuilderInputTable.java From netbeans with Apache License 2.0 | 6 votes |
private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { JTable source = (JTable)(e.getSource()); if ( ! source.isEnabled () ) return; _inputTablePopupRow = source.rowAtPoint(new Point (e.getX(), e.getY())); _inputTablePopupColumn = source.columnAtPoint(new Point (e.getX(), e.getY())); // Make sure the row where click occurred is selected. if (_inputTablePopupRow != -1) { source.setRowSelectionInterval (_inputTablePopupRow, _inputTablePopupRow); } // if ( _inputTablePopupColumn != Criteria_COLUMN ) // { // // return without showing popup // return; // } _inputTablePopup.show(e.getComponent(), e.getX(), e.getY()); } }
Example 3
Source File: EquipInfoTab.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private static List<EquipNode> getMenuTargets(JTable table, MouseEvent e) { int row = table.rowAtPoint(e.getPoint()); if (!table.isRowSelected(row)) { if ((row >= 0) && (table.getRowCount() > row)) { table.setRowSelectionInterval(row, row); } } return Arrays.stream(table.getSelectedRows()) .mapToObj(selRow -> table.getModel().getValueAt(selRow, 0)) .filter(value -> value instanceof EquipNode) .map(value -> (EquipNode) value) .collect(Collectors.toList()); }
Example 4
Source File: PurchaseInfoTab.java From pcgen with GNU Lesser General Public License v2.1 | 6 votes |
private static List<EquipmentFacade> getMenuTargets(JTable table, MouseEvent e) { int row = table.rowAtPoint(e.getPoint()); if (!table.isRowSelected(row)) { if ((row >= 0) && (table.getRowCount() > row)) { table.setRowSelectionInterval(row, row); } } return Arrays.stream(table.getSelectedRows()) .mapToObj(selRow -> table.getModel().getValueAt(selRow, 0)) .filter(value -> value instanceof EquipmentFacade) .map(value -> (EquipmentFacade) value) .collect(Collectors.toList()); }
Example 5
Source File: KseFrame.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
private void showSelectedEntryDetails(JTable jtKeyStore, int row) { jtKeyStore.setRowSelectionInterval(row, row); updateCutCopyPasteControls(); // Selection changed - update edit controls KeyStoreHistory history = getActiveKeyStoreHistory(); KeyStore keyStore = history.getCurrentState().getKeyStore(); String alias = getSelectedEntryAlias(); try { if (KeyStoreUtil.isKeyPairEntry(alias, keyStore)) { keyPairCertificateChainDetailsAction.showCertificateSelectedEntry(); } else if (KeyStoreUtil.isTrustedCertificateEntry(alias, keyStore)) { trustedCertificateDetailsAction.showCertificateSelectedEntry(); } else if (KeyStoreUtil.isKeyEntry(alias, keyStore)) { keyDetailsAction.showKeySelectedEntry(); } } catch (Exception ex) { DError.displayError(frame, ex); } }
Example 6
Source File: PlayerFunctions.java From aurous-app with GNU General Public License v2.0 | 5 votes |
public static void shuffle() { final JTable table = TabelPanel.table; final int totalIndexs = table.getRowCount(); final int randomIndex = new Random().nextInt(totalIndexs); table.setRowSelectionInterval(0, randomIndex); MediaUtils.switchMedia(table); }
Example 7
Source File: HerciLSTab.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
protected void displayRow(JTable table, int fromRow, int row) { long reset_l = (long) table.getValueAt(row, HealthTableModel.RESET_COL); long uptime = (long)table.getValueAt(row, HealthTableModel.UPTIME_COL); //Log.println("RESET: " + reset); //Log.println("UPTIME: " + uptime); int reset = (int)reset_l; updateTab((RadiationTelemetry) Config.payloadStore.getFramePart(foxId, reset, uptime, Spacecraft.RAD2_LAYOUT, false), false); if (fromRow == NO_ROW_SELECTED) fromRow = row; if (fromRow <= row) table.setRowSelectionInterval(fromRow, row); else table.setRowSelectionInterval(row, fromRow); }
Example 8
Source File: WodVulcanTab.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
protected void displayRow(JTable table, int row) { long reset_l = (long) table.getValueAt(row, HealthTableModel.RESET_COL); long uptime = (long)table.getValueAt(row, HealthTableModel.UPTIME_COL); //Log.println("RESET: " + reset); //Log.println("UPTIME: " + uptime); int reset = (int)reset_l; updateTab((RadiationTelemetry) Config.payloadStore.getFramePart(foxId, reset, uptime, Spacecraft.WOD_RAD2_LAYOUT, false), false); table.setRowSelectionInterval(row, row); }
Example 9
Source File: HerciHSTab.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
protected void displayRow(JTable table, int fromRow, int row) { long type_l = 0; long reset_l = (long) table.getValueAt(row, HealthTableModel.RESET_COL); long uptime = (long)table.getValueAt(row, HealthTableModel.UPTIME_COL); type_l = (long)table.getValueAt(row, HerciHSTableModel.TYPE_COL); Log.println("RESET: " + reset_l); Log.println("UPTIME: " + uptime); Log.println("TYPE: " + type_l); int reset = (int)reset_l; int type = (int)type_l; int headerType = 0; if (table.getModel() instanceof HerciHSTableModel) headerType = type + 200; else { type = (int)(type/1000); headerType = type + 200; // FIXME - these hard coded numbers should be tied back to the base types 600 / 800 } Log.println("Header Type: " + headerType); this.hsPayload = (PayloadHERCIhighSpeed) Config.payloadStore.getFramePart(foxId, reset, uptime, type, Spacecraft.HERCI_HS_LAYOUT, false); updateTab((HerciHighspeedHeader) Config.payloadStore.getFramePart(foxId, reset, uptime, headerType, Spacecraft.HERCI_HS_HEADER_LAYOUT, false), false); if (fromRow == NO_ROW_SELECTED) fromRow = row; if (fromRow <= row) table.setRowSelectionInterval(fromRow, row); else table.setRowSelectionInterval(row, fromRow); }
Example 10
Source File: VulcanTab.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
protected void displayRow(JTable table, int fromRow, int row) { long reset_l = (long) table.getValueAt(row, HealthTableModel.RESET_COL); long uptime = (long)table.getValueAt(row, HealthTableModel.UPTIME_COL); //Log.println("RESET: " + reset); //Log.println("UPTIME: " + uptime); int reset = (int)reset_l; updateTab((RadiationTelemetry) Config.payloadStore.getFramePart(foxId, reset, uptime, Spacecraft.RAD2_LAYOUT, false), false); if (fromRow == NO_ROW_SELECTED) fromRow = row; if (fromRow <= row) table.setRowSelectionInterval(fromRow, row); else table.setRowSelectionInterval(row, fromRow); }
Example 11
Source File: PlayerFunctions.java From aurous-app with GNU General Public License v2.0 | 5 votes |
public static void seekNext() { final JTable table = TabelPanel.table; if (table != null) { final int total = table.getRowCount(); final int idx = table.getSelectedRow(); if (total == 0) { return; } else if ((idx == -1) && (total == 0)) { return; } else if ((idx == -1) && (total > 0)) { table.setRowSelectionInterval(0, 0); MediaUtils.switchMedia(table); } else if ((idx + 1) == total) { table.setRowSelectionInterval(0, 0); MediaUtils.switchMedia(table); } else { try { table.setRowSelectionInterval(0, idx + 1); MediaUtils.switchMedia(table); } catch (final Exception e) { table.setRowSelectionInterval(0, 0); MediaUtils.switchMedia(table); } } } }
Example 12
Source File: PlayerFunctions.java From aurous-app with GNU General Public License v2.0 | 5 votes |
public static void seekPrevious() { final JTable table = TabelPanel.table; if (table != null) { final int total = table.getRowCount(); final int idx = table.getSelectedRow(); if (total == 0) { return; } else if ((idx == -1) && (total == 0)) { return; } else if ((idx == -1) && (total > 0)) { table.setRowSelectionInterval(0, total - 1); MediaUtils.switchMedia(table); } else if (idx <= 0) { table.setRowSelectionInterval(0, total - 1); MediaUtils.switchMedia(table); } else { try { table.setRowSelectionInterval(0, idx - 1); MediaUtils.switchMedia(table); } catch (final Exception e) { table.setRowSelectionInterval(0, 0); MediaUtils.switchMedia(table); } } } }
Example 13
Source File: CreateAvdVisualPanel2.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { Component comp = e.getComponent(); if (comp instanceof JTable) { JTable table = (JTable) comp; int rowIndex = table.rowAtPoint(e.getPoint()); table.setRowSelectionInterval(rowIndex, rowIndex); } popupMenu.show(comp, e.getX(), e.getY()); } }
Example 14
Source File: PlayerFunctions.java From aurous-app with GNU General Public License v2.0 | 5 votes |
public static void repeat() { final JTable table = TabelPanel.table; if (table != null) { if (table.getRowCount() > 0) { final int index = table.getSelectedRow(); table.setRowSelectionInterval(0, index); MediaUtils.switchMedia(table); } else { } } }
Example 15
Source File: QueryBuilderInputTable.java From netbeans with Apache License 2.0 | 5 votes |
/** Handle the key pressed event and change the focus if a particular * key combination is pressed. */ public void keyPressed(KeyEvent e) { if( e.isShiftDown() ) { int code = e.getKeyCode(); switch(code) { // diagram pane case KeyEvent.VK_F10: JTable source = (JTable)(e.getSource()); if (DEBUG) System.out.println( "QBIT : keyPressed called Shift+F10 Down source.isEnabled() returns : " + source.isEnabled() + "\n" ); if ( ! source.isEnabled () ) return; // _inputTablePopupRow = source.getEditingRow(); _inputTablePopupRow = source.getSelectedRow(); _inputTablePopupColumn = source.getEditingColumn(); if (_inputTablePopupColumn == (Criteria_COLUMN-1)) { source.setEditingColumn(Column_COLUMN); } if (DEBUG) System.out.println( "QBIT : keyPressed called\n" + " inputTablePopupRow = " + _inputTablePopupRow // NOI18N + " inputTablePopupColumn == Criteria_COLUMN " + (_inputTablePopupRow == Criteria_COLUMN ) // NOI18N + " inputTablePopupColumn = " + _inputTablePopupColumn ); // NOI18N // Make sure the row where click occurred is selected. if (_inputTablePopupRow != -1) { source.setRowSelectionInterval (_inputTablePopupRow, _inputTablePopupRow); } _inputTablePopup.show ( source, source.getWidth() / 2, source.getHeight() / 2 ); break; } } _queryBuilder.handleKeyPress(e); }
Example 16
Source File: QueryBuilderResultTable.java From netbeans with Apache License 2.0 | 5 votes |
private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { JTable source = (JTable)(e.getSource()); int row = source.rowAtPoint(e.getPoint()); int column = source.columnAtPoint(e.getPoint()); // Make sure the row where click occurred is selected. if (row != -1) { source.setRowSelectionInterval (row, row); } resultTablePopup.show(e.getComponent(), e.getX(), e.getY()); } }
Example 17
Source File: SwingUtil.java From Repeat with Apache License 2.0 | 4 votes |
public static void focusCellTable(JTable table, int row, int column) { table.setRowSelectionInterval(row, row); table.setColumnSelectionInterval(column, column); }
Example 18
Source File: SwingUtil.java From Repeat with Apache License 2.0 | 4 votes |
public static void focusColumnTable(JTable table, int column) { table.setColumnSelectionInterval(column, column); table.setRowSelectionInterval(0, table.getColumnCount() - 1); }
Example 19
Source File: MenuManager.java From jeveassets with GNU General Public License v2.0 | 4 votes |
private void selectClickedCell(final MouseEvent e) { Object source = e.getSource(); if (source instanceof JTable) { JTable jSelectTable = (JTable) source; Point point = e.getPoint(); if (!jSelectTable.getVisibleRect().contains(point)) { //Ignore clickes outside table return; } int clickedRow = jSelectTable.rowAtPoint(point); int clickedColumn = jSelectTable.columnAtPoint(point); //Rows boolean clickInRowsSelection; if (jSelectTable.getRowSelectionAllowed()) { //clicked in selected rows? clickInRowsSelection = false; int[] selectedRows = jSelectTable.getSelectedRows(); for (int i = 0; i < selectedRows.length; i++) { if (selectedRows[i] == clickedRow) { clickInRowsSelection = true; break; } } } else { //Row selection not allowed - all rows selected clickInRowsSelection = true; } //Column boolean clickInColumnsSelection; if (jSelectTable.getColumnSelectionAllowed()) { //clicked in selected columns? clickInColumnsSelection = false; int[] selectedColumns = jSelectTable.getSelectedColumns(); for (int i = 0; i < selectedColumns.length; i++) { if (selectedColumns[i] == clickedColumn) { clickInColumnsSelection = true; break; } } } else { //Column selection not allowed - all columns selected clickInColumnsSelection = true; } //Clicked outside selection, select clicked cell if ( (!clickInRowsSelection || !clickInColumnsSelection) && clickedRow >= 0 && clickedColumn >= 0) { jSelectTable.setRowSelectionInterval(clickedRow, clickedRow); jSelectTable.setColumnSelectionInterval(clickedColumn, clickedColumn); } } }
Example 20
Source File: PathnameTableModel.java From ghidra with Apache License 2.0 | 4 votes |
private void notifyDataChanged(JTable table, int newIndex) { fireTableDataChanged(); table.setRowSelectionInterval(newIndex, newIndex); Rectangle rect = table.getCellRect(newIndex, 0, true); table.scrollRectToVisible(rect); }