Java Code Examples for javax.swing.JTable#removeEditor()
The following examples show how to use
javax.swing.JTable#removeEditor() .
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: MosaicExpressionsPanel.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
private MouseListener createExpressionEditorMouseListener(final JTable table, final boolean booleanExpected) { final MouseAdapter mouseListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { final int column = table.getSelectedColumn(); if (column == 1) { table.removeEditor(); final int row = table.getSelectedRow(); final String[] value = new String[]{(String) table.getValueAt(row, column)}; final int i = editExpression(value, booleanExpected); if (ModalDialog.ID_OK == i) { table.setValueAt(value[0], row, column); } } } } }; return MouseEventFilterFactory.createFilter(mouseListener); }
Example 2
Source File: MosaicExpressionsPanel.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
private static void moveRowsDown(final JTable table, final int[] rows) { final int maxRow = table.getRowCount() - 1; for (int row1 : rows) { if (row1 == maxRow) { return; } } table.removeEditor(); int[] selectedRows = rows.clone(); for (int i = rows.length - 1; i > -1; i--) { int row = rows[i]; ((DefaultTableModel) table.getModel()).moveRow(row, row, row + 1); selectedRows[i] = row + 1; } selectRows(table, selectedRows); }
Example 3
Source File: TableViewPagePanel.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@Override protected void initComponents() { final AbstractButton switchToChartButton = ToolButtonFactory.createButton(iconForSwitchToChartButton, false); switchToChartButton.setToolTipText("Switch to Chart View"); switchToChartButton.setName("switchToChartButton"); switchToChartButton.setEnabled(hasAlternativeView()); switchToChartButton.addActionListener(e -> showAlternativeView()); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.add(switchToChartButton, BorderLayout.NORTH); buttonPanel.add(getHelpButton(), BorderLayout.SOUTH); add(buttonPanel, BorderLayout.EAST); table = new JTable(); table.removeEditor(); table.setGridColor(Color.LIGHT_GRAY.brighter()); table.addMouseListener(new PagePanel.PopupHandler()); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); final JScrollPane scrollPane = new JScrollPane(table); add(scrollPane, BorderLayout.CENTER); }
Example 4
Source File: MosaicExpressionsPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private static void addRow(final JTable table, final Object[] rowData) { table.removeEditor(); ((DefaultTableModel) table.getModel()).addRow(rowData); final int row = table.getRowCount() - 1; final int numCols = table.getColumnModel().getColumnCount(); for (int i = 0; i < Math.min(numCols, rowData.length); i++) { Object o = rowData[i]; table.setValueAt(o, row, i); } selectRows(table, row, row); }
Example 5
Source File: MosaicExpressionsPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private static void moveRowsUp(final JTable table, final int[] rows) { for (int row1 : rows) { if (row1 == 0) { return; } } table.removeEditor(); int[] selectedRows = rows.clone(); for (int i = 0; i < rows.length; i++) { int row = rows[i]; ((DefaultTableModel) table.getModel()).moveRow(row, row, row - 1); selectedRows[i] = row - 1; } selectRows(table, selectedRows); }
Example 6
Source File: MosaicExpressionsPanel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private static void removeRows(final JTable table, final int[] rows) { table.removeEditor(); for (int i = rows.length - 1; i > -1; i--) { int row = rows[i]; ((DefaultTableModel) table.getModel()).removeRow(row); } }