1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| public class ButtonEditor extends JButton implements TableCellEditor {
protected EventListenerList listenerList = new EventListenerList();
protected ChangeEvent changeEvent = new ChangeEvent(this);
private int row;
private int column;
/** Master Panel containing Full GUI */
private final ExportMainPanel MASTER_PANEL;
public ButtonEditor(ExportMainPanel aPanel, ImageIcon icon) {
super(icon);
System.err.println("-------------->ButtonEditor");
MASTER_PANEL = aPanel;
//addActionListener(new DeletingDataAction(MASTER_PANEL, this));
}
public void addCellEditorListener(CellEditorListener listener) {
listenerList.add(CellEditorListener.class, listener);
}
public void removeCellEditorListener(CellEditorListener listener) {
listenerList.remove(CellEditorListener.class, listener);
}
public void cancelCellEditing() {
//fireEditingCanceled();
}
public boolean stopCellEditing() {
//fireEditingStopped();
return true;
}
public boolean isCellEditable(EventObject event) {
return true;
}
public boolean shouldSelectCell(EventObject event) {
return true;
}
//function call on a click
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
this.setName(String.valueOf(row));
return this;
}
public Object getCellEditorValue() {
return this;
}
} |
Partager