mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Perform the action on double click in the game list.
This commit is contained in:
parent
db2db4c27a
commit
18dbd06450
1 changed files with 16 additions and 0 deletions
|
@ -9,6 +9,8 @@ package mage.client.table;
|
|||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.io.File;
|
||||
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));
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue