X-Git-Url: https://git.pterodactylus.net/?p=jkeytool.git;a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Fjkeytool%2Fgui%2Fswing%2FKeyStorePanel.java;h=9367221e1f5c000805a1d8f6ba6215763e5b021e;hp=4496318430be937d11a22063c292ed869dc5fb75;hb=caae8a8c82efbd16ae5a45ee352a761e445d5de5;hpb=e5e4a88c5a229c289d3b43f0d0b1d4b4df91c9fb diff --git a/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java b/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java index 4496318..9367221 100644 --- a/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java +++ b/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java @@ -19,14 +19,17 @@ package net.pterodactylus.jkeytool.gui.swing; -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; import java.security.KeyStore; -import javax.swing.AbstractAction; -import javax.swing.Action; +import javax.swing.BorderFactory; import javax.swing.JPanel; -import javax.swing.JToolBar; +import javax.swing.JTextField; + +import net.pterodactylus.util.i18n.I18n; +import net.pterodactylus.util.i18n.gui.I18nLabel; /** * TODO @@ -35,26 +38,25 @@ import javax.swing.JToolBar; */ public class KeyStorePanel extends JPanel { + /** The I18n container. */ + private final I18n i18n; + /** The displayed key store. */ private final KeyStore keyStore; - /** The tool bar. */ - private final JToolBar toolBar = new JToolBar(); - - /** The action to create a new key. */ - private Action createKeyAction; - /** * 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 */ - public KeyStorePanel(KeyStore keyStore) { - super(new BorderLayout()); + public KeyStorePanel(I18n i18n, KeyStore keyStore) { + super(new GridBagLayout()); + this.i18n = i18n; this.keyStore = keyStore; - constructActions(); constructPanel(); } @@ -62,31 +64,23 @@ public class KeyStorePanel extends JPanel { // PRIVATE ACTIONS // - private void createKey() { - - } - // // PRIVATE METHODS // - private void constructActions() { - createKeyAction = new AbstractAction("Create Key") { - - /** - * {@inheritDoc} - */ - @SuppressWarnings("synthetic-access") - public void actionPerformed(ActionEvent actionEvent) { - createKey(); - } - }; - } - + /** + * Constructs the main panel. + */ private void constructPanel() { - toolBar.add(createKeyAction); + 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(toolBar, BorderLayout.PAGE_START); + 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)); } }