mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Enforced singleton pattern in FControl.
This commit is contained in:
@@ -39,7 +39,10 @@ import forge.control.KeyboardShortcuts.Shortcut;
|
|||||||
* between various display states in that JFrame. Controllers are instantiated
|
* between various display states in that JFrame. Controllers are instantiated
|
||||||
* separately by each state's top level view class.
|
* separately by each state's top level view class.
|
||||||
*/
|
*/
|
||||||
public final class FControl {
|
public enum FControl {
|
||||||
|
/** */
|
||||||
|
SINGLETON_INSTANCE;
|
||||||
|
|
||||||
private List<Shortcut> shortcuts;
|
private List<Shortcut> shortcuts;
|
||||||
private JLayeredPane display;
|
private JLayeredPane display;
|
||||||
private int state;
|
private int state;
|
||||||
@@ -63,7 +66,7 @@ public final class FControl {
|
|||||||
* switches between various display states in that JFrame. Controllers are
|
* switches between various display states in that JFrame. Controllers are
|
||||||
* instantiated separately by each state's top level view class.
|
* instantiated separately by each state's top level view class.
|
||||||
*/
|
*/
|
||||||
public FControl() {
|
private FControl() {
|
||||||
// "Close" button override during match
|
// "Close" button override during match
|
||||||
this.waConcede = new WindowAdapter() {
|
this.waConcede = new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public final class Main {
|
|||||||
try {
|
try {
|
||||||
final FModel model = new FModel();
|
final FModel model = new FModel();
|
||||||
final FView view = new FView();
|
final FView view = new FView();
|
||||||
final FControl control = new FControl();
|
final FControl control = FControl.SINGLETON_INSTANCE;
|
||||||
|
|
||||||
Singletons.setModel(model);
|
Singletons.setModel(model);
|
||||||
Singletons.setView(view);
|
Singletons.setView(view);
|
||||||
|
|||||||
Reference in New Issue
Block a user