From a472334662c884abba8d2c1d47bed9f0c11525d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 20 Jan 2009 07:30:55 +0100 Subject: [PATCH] Open and create key stores in an internal frame. --- src/net/pterodactylus/jkeytool/gui/MainFrame.java | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/net/pterodactylus/jkeytool/gui/MainFrame.java b/src/net/pterodactylus/jkeytool/gui/MainFrame.java index dcdaf37..cd6052a 100644 --- a/src/net/pterodactylus/jkeytool/gui/MainFrame.java +++ b/src/net/pterodactylus/jkeytool/gui/MainFrame.java @@ -24,13 +24,16 @@ import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; +import java.beans.PropertyVetoException; import java.io.File; import java.security.KeyStore; import javax.swing.AbstractAction; import javax.swing.Action; +import javax.swing.JDesktopPane; import javax.swing.JFileChooser; import javax.swing.JFrame; +import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JOptionPane; @@ -53,6 +56,9 @@ public class MainFrame implements CoreListener, WindowListener { /** The main frame. */ private final JFrame mainFrame; + /** The main frame’s desktop. */ + private final JDesktopPane desktop; + /** The jkeytool core. */ private final Core core; @@ -77,6 +83,8 @@ public class MainFrame implements CoreListener, WindowListener { constructActions(); mainFrame.setJMenuBar(constructMenuBar()); mainFrame.addWindowListener(this); + desktop = new JDesktopPane(); + mainFrame.setContentPane(desktop); mainFrame.pack(); } @@ -190,6 +198,19 @@ public class MainFrame implements CoreListener, WindowListener { return keystoreTypeMenu; } + private void constructKeyStoreWindow(KeyStore keyStore) { + JInternalFrame internalFrame = new JInternalFrame("Key Store (" + keyStore.getType() + ")", true, true, true, true); + internalFrame.getContentPane().add(new ListKeyStorePanel(keyStore)); + internalFrame.setBounds(10, 10, 200, 200); + desktop.add(internalFrame); + internalFrame.setVisible(true); + try { + internalFrame.setSelected(true); + } catch (PropertyVetoException pve1) { + pve1.printStackTrace(); + } + } + // // PRIVATE ACTIONS // @@ -245,7 +266,7 @@ public class MainFrame implements CoreListener, WindowListener { * {@inheritDoc} */ public void keyStoreCreated(KeyStore keyStore) { - /* TODO */ + constructKeyStoreWindow(keyStore); } /** @@ -259,7 +280,7 @@ public class MainFrame implements CoreListener, WindowListener { * {@inheritDoc} */ public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) { - /* TODO - create keystore frame. */ + constructKeyStoreWindow(keyStore); } /** -- 2.7.4