2 * jkeytool - KeyStorePanel.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;
22 import java.awt.GridBagConstraints;
23 import java.awt.GridBagLayout;
24 import java.awt.Insets;
25 import java.security.KeyStore;
27 import javax.swing.BorderFactory;
28 import javax.swing.JPanel;
29 import javax.swing.JTextField;
31 import net.pterodactylus.util.i18n.I18n;
32 import net.pterodactylus.util.i18n.gui.I18nLabel;
37 * @author David Roden <droden@gmail.com>
39 public class KeyStorePanel extends JPanel {
41 /** The I18n container. */
42 private final I18n i18n;
44 /** The displayed key store. */
45 private final KeyStore keyStore;
48 * Creates a new key store panel that displays and controls the given key
54 * The key store to display
56 public KeyStorePanel(I18n i18n, KeyStore keyStore) {
57 super(new GridBagLayout());
59 this.keyStore = keyStore;
72 * Constructs the main panel.
74 private void constructPanel() {
75 setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
76 I18nLabel keyStoreTypeLabel = new I18nLabel(i18n, "jkeytool.keyStorePanel.keyStoreTypeLabel");
77 JTextField keyStoreTypeTextField = new JTextField(keyStore.getType());
78 keyStoreTypeTextField.setEditable(false);
80 i18n.registerI18nable(keyStoreTypeLabel);
82 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));
83 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));