mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
ensure the start button can only be clicked once at a time
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
package forge.gui.home;
|
package forge.gui.home;
|
||||||
|
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
|
|
||||||
@@ -30,5 +33,17 @@ public class StartButton extends JButton {
|
|||||||
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
|
setIcon(FSkin.getIcon(FSkin.ButtonImages.IMG_BTN_START_OVER));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
setEnabled(false);
|
||||||
|
|
||||||
|
// ensure the click action can resolve before we allow the button to be clicked again
|
||||||
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
@Override public void run() { setEnabled(true); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user