Show key store type in key store panel.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 Jan 2009 23:52:28 +0000 (00:52 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 Jan 2009 23:52:40 +0000 (00:52 +0100)
Use new I18n container.

src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java
src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java

index dfc9c6e..9367221 100644 (file)
 
 package net.pterodactylus.jkeytool.gui.swing;
 
 
 package net.pterodactylus.jkeytool.gui.swing;
 
-import java.awt.BorderLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
 import java.security.KeyStore;
 
 import java.security.KeyStore;
 
+import javax.swing.BorderFactory;
 import javax.swing.JPanel;
 import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import net.pterodactylus.util.i18n.I18n;
+import net.pterodactylus.util.i18n.gui.I18nLabel;
 
 /**
  * TODO
 
 /**
  * TODO
@@ -31,6 +38,9 @@ import javax.swing.JPanel;
  */
 public class KeyStorePanel extends JPanel {
 
  */
 public class KeyStorePanel extends JPanel {
 
+       /** The I18n container. */
+       private final I18n i18n;
+
        /** The displayed key store. */
        private final KeyStore keyStore;
 
        /** The displayed key store. */
        private final KeyStore keyStore;
 
@@ -38,11 +48,14 @@ public class KeyStorePanel extends JPanel {
         * Creates a new key store panel that displays and controls the given key
         * store.
         *
         * Creates a new key store panel that displays and controls the given key
         * store.
         *
+        * @param i18n
+        *            The I18n container
         * @param keyStore
         *            The key store to display
         */
         * @param keyStore
         *            The key store to display
         */
-       public KeyStorePanel(KeyStore keyStore) {
-               super(new BorderLayout());
+       public KeyStorePanel(I18n i18n, KeyStore keyStore) {
+               super(new GridBagLayout());
+               this.i18n = i18n;
                this.keyStore = keyStore;
                constructPanel();
        }
                this.keyStore = keyStore;
                constructPanel();
        }
@@ -59,6 +72,15 @@ public class KeyStorePanel extends JPanel {
         * Constructs the main panel.
         */
        private void constructPanel() {
         * Constructs the main panel.
         */
        private void constructPanel() {
+               setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
+               I18nLabel keyStoreTypeLabel = new I18nLabel(i18n, "jkeytool.keyStorePanel.keyStoreTypeLabel");
+               JTextField keyStoreTypeTextField = new JTextField(keyStore.getType());
+               keyStoreTypeTextField.setEditable(false);
+
+               i18n.registerI18nable(keyStoreTypeLabel);
+
+               add(keyStoreTypeLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+               add(keyStoreTypeTextField, new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.FIRST_LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 12, 0, 0), 0, 0));
        }
 
 }
        }
 
 }
index 3c99f0b..165a6d6 100644 (file)
@@ -229,7 +229,7 @@ public class SwingInterface implements Interface {
         * {@inheritDoc}
         */
        public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
         * {@inheritDoc}
         */
        public void keyStoreLoaded(File keyStoreFile, KeyStore keyStore) {
-               KeyStorePanel keyStorePanel = new KeyStorePanel(keyStore);
+               KeyStorePanel keyStorePanel = new KeyStorePanel(i18n, keyStore);
                keyStores.put(keyStore, keyStorePanel);
                tabPane.addTab(keyStoreFile.getName(), keyStorePanel);
        }
                keyStores.put(keyStore, keyStorePanel);
                tabPane.addTab(keyStoreFile.getName(), keyStorePanel);
        }