@Test public void testActionPerformed() { System.out.println("actionPerformed"); ActionEvent e = null; CopyRowAction instance = new CopyRowAction(new JPanel(), new JTable(), new PowerTableModel(TableModelEmul.columnIdentifiers, TableModelEmul.columnClasses), new JButton()); instance.actionPerformed(e); }
public void actionPerformed(ActionEvent e) { if (grid.isEditing()) { TableCellEditor cellEditor = grid.getCellEditor(grid.getEditingRow(), grid.getEditingColumn()); cellEditor.stopCellEditing(); } final int selectedRow = grid.getSelectedRow(); if (tableModel.getRowCount() == 0 || selectedRow < 0) { return; } tableModel.addRow(tableModel.getRowData(selectedRow)); tableModel.fireTableDataChanged(); deleteRowButton.setEnabled(true); int rowToSelect = selectedRow + 1; grid.setRowSelectionInterval(rowToSelect, rowToSelect); sender.updateUI(); }
CopyRowAction implements ActionListener { public void actionPerformed(ActionEvent e) { if (grid.isEditing()) { TableCellEditor cellEditor = grid.getCellEditor(grid.getEditingRow(), grid.getEditingColumn()); cellEditor.stopCellEditing(); } final int selectedRow = grid.getSelectedRow(); if (tableModel.getRowCount() == 0 || selectedRow < 0) { return; } tableModel.addRow(tableModel.getRowData(selectedRow)); tableModel.fireTableDataChanged(); deleteRowButton.setEnabled(true); int rowToSelect = selectedRow + 1; grid.setRowSelectionInterval(rowToSelect, rowToSelect); sender.updateUI(); } }
CopyRowAction implements ActionListener { public void actionPerformed(ActionEvent e) { if (grid.isEditing()) { TableCellEditor cellEditor = grid.getCellEditor(grid.getEditingRow(), grid.getEditingColumn()); cellEditor.stopCellEditing(); } final int selectedRow = grid.getSelectedRow(); if (tableModel.getRowCount() == 0 || selectedRow < 0) { return; } tableModel.addRow(tableModel.getRowData(selectedRow)); tableModel.fireTableDataChanged(); deleteRowButton.setEnabled(true); int rowToSelect = selectedRow + 1; grid.setRowSelectionInterval(rowToSelect, rowToSelect); sender.updateUI(); } CopyRowAction(JComponent aSender, JTable grid, PowerTableModel tableModel, JButton deleteRowButton); }
CopyRowAction implements ActionListener { public void actionPerformed(ActionEvent e) { if (grid.isEditing()) { TableCellEditor cellEditor = grid.getCellEditor(grid.getEditingRow(), grid.getEditingColumn()); cellEditor.stopCellEditing(); } final int selectedRow = grid.getSelectedRow(); if (tableModel.getRowCount() == 0 || selectedRow < 0) { return; } tableModel.addRow(tableModel.getRowData(selectedRow)); tableModel.fireTableDataChanged(); deleteRowButton.setEnabled(true); int rowToSelect = selectedRow + 1; grid.setRowSelectionInterval(rowToSelect, rowToSelect); sender.updateUI(); } CopyRowAction(JComponent aSender, JTable grid, PowerTableModel tableModel, JButton deleteRowButton); void actionPerformed(ActionEvent e); }
CopyRowAction implements ActionListener { public void actionPerformed(ActionEvent e) { if (grid.isEditing()) { TableCellEditor cellEditor = grid.getCellEditor(grid.getEditingRow(), grid.getEditingColumn()); cellEditor.stopCellEditing(); } final int selectedRow = grid.getSelectedRow(); if (tableModel.getRowCount() == 0 || selectedRow < 0) { return; } tableModel.addRow(tableModel.getRowData(selectedRow)); tableModel.fireTableDataChanged(); deleteRowButton.setEnabled(true); int rowToSelect = selectedRow + 1; grid.setRowSelectionInterval(rowToSelect, rowToSelect); sender.updateUI(); } CopyRowAction(JComponent aSender, JTable grid, PowerTableModel tableModel, JButton deleteRowButton); void actionPerformed(ActionEvent e);  }