Perform the action on double click in the game list.

This commit is contained in:
rkfg 2018-08-11 23:55:19 +03:00
parent db2db4c27a
commit 18dbd06450

View file

@ -9,6 +9,8 @@ package mage.client.table;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyVetoException; import java.beans.PropertyVetoException;
import java.io.File; import java.io.File;
import java.text.DateFormat; import java.text.DateFormat;
@ -316,6 +318,20 @@ public class TablesPanel extends javax.swing.JPanel {
actionButton1 = new ButtonColumn(tableTables, openTableAction, tableTables.convertColumnIndexToView(TableTableModel.ACTION_COLUMN)); actionButton1 = new ButtonColumn(tableTables, openTableAction, tableTables.convertColumnIndexToView(TableTableModel.ACTION_COLUMN));
actionButton2 = new ButtonColumn(tableCompleted, closedTableAction, tableCompleted.convertColumnIndexToView(MatchesTableModel.COLUMN_ACTION)); actionButton2 = new ButtonColumn(tableCompleted, closedTableAction, tableCompleted.convertColumnIndexToView(MatchesTableModel.COLUMN_ACTION));
// !!!! // !!!!
addTableDoubleClickListener(tableTables, openTableAction);
addTableDoubleClickListener(tableCompleted, closedTableAction);
}
private void addTableDoubleClickListener(JTable table, Action action) {
table.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
int row = table.rowAtPoint(e.getPoint());
if (e.getClickCount() == 2 && row != -1) {
action.actionPerformed(new ActionEvent(e.getSource(), e.getID(), "" + row));
}
}
});
} }
public void cleanUp() { public void cleanUp() {