From: David ‘Bombe’ Roden Date: Mon, 26 Jan 2009 23:27:32 +0000 (+0100) Subject: Add Interface.setCore(Core) method to set the core that is controlled by the interface. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=93811f6061a8da43bd50cf04cffcc150d465f845;p=jkeytool.git Add Interface.setCore(Core) method to set the core that is controlled by the interface. --- diff --git a/src/net/pterodactylus/jkeytool/gui/Interface.java b/src/net/pterodactylus/jkeytool/gui/Interface.java index 7b278ce..44b0a65 100644 --- a/src/net/pterodactylus/jkeytool/gui/Interface.java +++ b/src/net/pterodactylus/jkeytool/gui/Interface.java @@ -19,6 +19,7 @@ package net.pterodactylus.jkeytool.gui; +import net.pterodactylus.jkeytool.core.Core; import net.pterodactylus.jkeytool.core.CoreListener; /** @@ -29,6 +30,14 @@ import net.pterodactylus.jkeytool.core.CoreListener; public interface Interface extends CoreListener { /** + * Sets the core to control. + * + * @param core + * The core to control + */ + public void setCore(Core core); + + /** * Starts the interface, usually by making it visible. */ public void start(); diff --git a/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java b/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java index 388846d..4d287d9 100644 --- a/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java +++ b/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java @@ -22,6 +22,7 @@ package net.pterodactylus.jkeytool.gui.swing; import java.io.File; import java.security.KeyStore; +import net.pterodactylus.jkeytool.core.Core; import net.pterodactylus.jkeytool.gui.Interface; /** @@ -31,11 +32,24 @@ import net.pterodactylus.jkeytool.gui.Interface; */ public class SwingInterface implements Interface { + /** The core to control. */ + private Core core; + // // INTERFACE Interface // /** + * Sets the core to control. + * + * @param core + * The core to control + */ + public void setCore(Core core) { + this.core = core; + } + + /** * {@inheritDoc} */ public void start() { diff --git a/src/net/pterodactylus/jkeytool/main/Main.java b/src/net/pterodactylus/jkeytool/main/Main.java index 9f4b477..26a9496 100644 --- a/src/net/pterodactylus/jkeytool/main/Main.java +++ b/src/net/pterodactylus/jkeytool/main/Main.java @@ -56,6 +56,7 @@ public class Main { public static void main(String[] arguments) { Core core = new Core(); Interface gui = getInterface(); + gui.setCore(core); core.addCoreListener(gui); gui.start(); }