mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
* Fixed ArrayIndexOutOfBoundsException by trying to do actions on tables removed meanwhile.
This commit is contained in:
parent
acb57c0fc8
commit
cdbda6a7e6
1 changed files with 48 additions and 49 deletions
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.client.util;
|
||||
|
||||
import java.awt.Component;
|
||||
|
|
@ -78,18 +77,13 @@ public class ButtonColumn extends AbstractCellEditor implements TableCellRendere
|
|||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
if (hasFocus)
|
||||
{
|
||||
if (hasFocus) {
|
||||
renderButton.setForeground(table.getForeground());
|
||||
renderButton.setBackground(UIManager.getColor("Button.background"));
|
||||
}
|
||||
else if (isSelected)
|
||||
{
|
||||
} else if (isSelected) {
|
||||
renderButton.setForeground(table.getSelectionForeground());
|
||||
renderButton.setBackground(table.getSelectionBackground());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
renderButton.setForeground(table.getForeground());
|
||||
renderButton.setBackground(UIManager.getColor("Button.background"));
|
||||
}
|
||||
|
|
@ -107,35 +101,40 @@ public class ButtonColumn extends AbstractCellEditor implements TableCellRendere
|
|||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (table.getRowCount() >= table.getEditingRow()) {
|
||||
int row = table.convertRowIndexToModel(table.getEditingRow());
|
||||
fireEditingStopped();
|
||||
ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, "" + row);
|
||||
action.actionPerformed(event);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent arg0) {
|
||||
if (table.isEditing() && table.getCellEditor() == this)
|
||||
if (table.isEditing() && table.getCellEditor() == this) {
|
||||
isButtonColumnEditor = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
if (isButtonColumnEditor && table.isEditing())
|
||||
if (isButtonColumnEditor && table.isEditing()) {
|
||||
table.getCellEditor().stopCellEditing();
|
||||
}
|
||||
|
||||
isButtonColumnEditor = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent arg0) {}
|
||||
public void mouseClicked(MouseEvent arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent arg0) {}
|
||||
public void mouseEntered(MouseEvent arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent arg0) {}
|
||||
|
||||
public void mouseExited(MouseEvent arg0) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue