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=add75818cdcd0c49e10cef40e309a643122feea3;hb=caae8a8c82efbd16ae5a45ee352a761e445d5de5;hpb=4914c97e6d1993d822b98262264c23f58a2594d2 diff --git a/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java b/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java index add7581..9367221 100644 --- a/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java +++ b/src/net/pterodactylus/jkeytool/gui/swing/KeyStorePanel.java @@ -19,16 +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.swing.StatusBar; +import net.pterodactylus.util.i18n.I18n; +import net.pterodactylus.util.i18n.gui.I18nLabel; /** * TODO @@ -37,72 +38,49 @@ import net.pterodactylus.util.swing.StatusBar; */ 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 status bar. */ - private final StatusBar statusBar = new StatusBar(); - - /** 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(); - statusBar.setText(keyStore.getType() + " Key Store"); } // // PRIVATE ACTIONS // - /** - * Executed by {@link #createKeyAction}. - */ - private void createKey() { - /* TODO */ - } - // // PRIVATE METHODS // /** - * Constructs all used actions. - */ - 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(statusBar, BorderLayout.PAGE_END); + 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)); } }