2 * jkeytool - SwingInterface.java -
3 * Copyright © 2009 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.jkeytool.gui.swing;
23 import java.security.KeyStore;
24 import java.util.HashMap;
27 import javax.swing.JFrame;
29 import net.pterodactylus.jkeytool.core.Core;
30 import net.pterodactylus.jkeytool.gui.Interface;
31 import net.pterodactylus.jkeytool.main.Main;
36 * @author David Roden <droden@gmail.com>
38 public class SwingInterface implements Interface {
40 /** The core to control. */
43 /** The main frame. */
44 private JFrame mainFrame = new JFrame("jkeytool " + Main.getVersion());
46 /** Loaded key stores and their panels. */
47 private final Map<KeyStore, KeyStorePanel> keyStores = new HashMap<KeyStore, KeyStorePanel>();
50 // INTERFACE Interface
54 * Sets the core to control.
59 public void setCore(Core core) {
67 mainFrame.setVisible(true);
68 core.loadKeyStore(new File("client.p12"));
79 // INTERFACE CoreListener
85 public void keyStoreCreated(KeyStore keyStore) {
92 public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
93 KeyStorePanel keyStorePanel = new KeyStorePanel(keyStore);
94 keyStores.put(keyStore, keyStorePanel);
95 mainFrame.getContentPane().add(keyStorePanel);
101 public void keyStoreNotCreated(String keyStoreType, Throwable reason) {
108 public void keyStoreNotLoaded(File keyStoreFile) {