Java Code Examples for javax.swing.JTable#clearSelection()
The following examples show how to use
javax.swing.JTable#clearSelection() .
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: DeckEditorSplitPanel.java From magarena with GNU General Public License v3.0 | 6 votes |
@Override public void mouseClicked(final MouseEvent e) { if (e.getClickCount() > 1) { if (e.getButton() == MouseEvent.BUTTON1) { removeSelectedFromDeck(); } else if (e.getButton() == MouseEvent.BUTTON3) { final List<MagicCardDefinition> deckCards = deckTable.getSelectedCards(); if (deckCards.size() > 0) { deck.addAll(deckCards); updateDeck(); } } } if (e.getButton() == MouseEvent.BUTTON3) { final JTable table = (JTable) (e.getSource()); final int row = table.rowAtPoint(e.getPoint()); table.clearSelection(); table.addRowSelectionInterval(row, row); } }
Example 2
Source File: VariationPerParameterTableController.java From OpenDA with GNU Lesser General Public License v3.0 | 5 votes |
/** * setting up the table. * * @param table JTable to store this.correlationTableModel */ private void setupBasicTableProperties(JTable table) { table.clearSelection(); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); TableRenderer cellRenderer = new TableRenderer(new JTextField()); table.setRowSelectionAllowed(true); table.setColumnSelectionAllowed(false); table.setVisible(true); table.setModel(this.variationPerParameterTableModel); initColumnSizes(table); for (int i = 0; i < table.getColumnCount(); i++) { TableColumn column = table.getColumnModel().getColumn(i); column.setCellRenderer(cellRenderer); } TableColumn columnName = table.getColumnModel().getColumn(VariationPerParameterTableModel.COLUMN_NAME); columnName.setCellEditor(new TextCellEditor()); TableColumn columnBasicValue = table.getColumnModel().getColumn(VariationPerParameterTableModel.COLUMN_BASIC_VALUE); columnBasicValue.setCellEditor(new TextCellEditor()); setupVariationFunctionComboBoxColumn(); this.variationPerParameterTableModel.fireTableDataChanged(); table.setColumnSelectionAllowed(false); table.setRowSelectionAllowed(true); //select first row. table.getSelectionModel().setSelectionInterval(0, 0); }
Example 3
Source File: ManageTable.java From database-transform-tool with Apache License 2.0 | 5 votes |
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { // System.out.println("--1---value:"+value+",isSelected:"+isSelected+",row:"+row+",column:"+column); table.clearSelection(); default_row = row; return panel; }
Example 4
Source File: ManageTable.java From database-transform-tool with Apache License 2.0 | 5 votes |
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,int row, int column) { // System.out.println("--2---value:"+value+",isSelected:"+isSelected+",hasFocus:"+hasFocus+",row:"+row+",column:"+column); table.clearSelection(); default_row = row; return panel; }
Example 5
Source File: JTableJavaElement.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public boolean marathon_select(String text) { JTable table = (JTable) component; boolean cellEditing = table.isEditing(); if (cellEditing) { return true; } if ("".equals(text)) { table.clearSelection(); return true; } int[] rows; int[] cols; if ("all".equals(text)) { int rowCount = table.getRowCount(); int columnCount = table.getColumnCount(); rows = new int[rowCount]; cols = new int[columnCount]; for (int i = 0; i < rowCount; i++) { rows[i] = i; } for (int i = 0; i < columnCount; i++) { cols[i] = i; } } else { rows = parseRows(text); String[] colNames = parseCols(text); cols = new int[colNames.length]; for (int i = 0; i < colNames.length; i++) { cols[i] = getColumnIndex(colNames[i]); } } return selectRowsColumns(table, rows, cols); }
Example 6
Source File: PixelInfoView.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
void clearSelectionInRasterTables() { final JTable bandsTable = (JTable) collapsibleItemsPanel.getItem(BANDS_INDEX).getComponent(); final JTable tiePointGridsTable = (JTable) collapsibleItemsPanel.getItem(TIE_POINT_GRIDS_INDEX).getComponent(); bandsTable.clearSelection(); tiePointGridsTable.clearSelection(); final RasterDataNode raster = modelUpdater.getCurrentRaster(); if (raster != null) { final String rasterName = raster.getName(); if (!selectCurrentRaster(rasterName, bandsTable)) { selectCurrentRaster(rasterName, tiePointGridsTable); } } }