From 7255bdf4430ded3abfbc342f15ccd9091b9617b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 28 Jan 2009 00:03:01 +0100 Subject: [PATCH] Add actions. --- .../jkeytool/gui/swing/SwingInterface.java | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java b/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java index 6a6597e..107dc8d 100644 --- a/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java +++ b/src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java @@ -20,11 +20,13 @@ package net.pterodactylus.jkeytool.gui.swing; import java.awt.BorderLayout; +import java.awt.event.ActionEvent; import java.io.File; import java.security.KeyStore; import java.util.HashMap; import java.util.Map; +import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JFrame; @@ -34,6 +36,7 @@ import javax.swing.JTabbedPane; import net.pterodactylus.jkeytool.core.Core; import net.pterodactylus.jkeytool.gui.Interface; import net.pterodactylus.jkeytool.main.Main; +import net.pterodactylus.util.i18n.gui.I18nAction; import net.pterodactylus.util.swing.StatusBar; /** @@ -55,17 +58,55 @@ public class SwingInterface implements Interface { /** The status bar. */ private StatusBar statusBar = new StatusBar(); + /** The “create key store” action. */ + private Action createKeyStoreAction; + + /** The “quit” action. */ + private Action quitAction; + /** Loaded key stores and their panels. */ private final Map keyStores = new HashMap(); public SwingInterface() { + createActions(); createFrame(); } // + // ACTIONS + // + + private void createKeyStore() { + } + + private void quit() { + System.exit(0); + } + + // // PRIVATE METHODS // + private void createActions() { + createKeyStoreAction = new I18nAction("jkeytool.action.createKeyStore") { + + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + createKeyStore(); + } + }; + quitAction = new I18nAction("jkeytool.action.quit") { + + /** + * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) + */ + @SuppressWarnings("synthetic-access") + public void actionPerformed(ActionEvent actionEvent) { + quit(); + } + }; + } + private void createFrame() { mainFrame.getContentPane().add(createCenterPanel(), BorderLayout.CENTER); mainFrame.getContentPane().add(statusBar, BorderLayout.PAGE_END); -- 2.7.4