Enforced singleton pattern in FControl.

This commit is contained in:
Doublestrike
2012-02-19 01:49:26 +00:00
parent 13d3179b47
commit 4f40e8fb10
2 changed files with 6 additions and 3 deletions

View File

@@ -39,7 +39,10 @@ import forge.control.KeyboardShortcuts.Shortcut;
* between various display states in that JFrame. Controllers are instantiated
* separately by each state's top level view class.
*/
public final class FControl {
public enum FControl {
/** */
SINGLETON_INSTANCE;
private List<Shortcut> shortcuts;
private JLayeredPane display;
private int state;
@@ -63,7 +66,7 @@ public final class FControl {
* switches between various display states in that JFrame. Controllers are
* instantiated separately by each state's top level view class.
*/
public FControl() {
private FControl() {
// "Close" button override during match
this.waConcede = new WindowAdapter() {
@Override

View File

@@ -46,7 +46,7 @@ public final class Main {
try {
final FModel model = new FModel();
final FView view = new FView();
final FControl control = new FControl();
final FControl control = FControl.SINGLETON_INSTANCE;
Singletons.setModel(model);
Singletons.setView(view);