use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.
the class DExportPrivateKeyOpenSsl method initComponents.
private void initComponents() {
GridBagConstraints gbcLbl = new GridBagConstraints();
gbcLbl.gridx = 0;
gbcLbl.gridwidth = 3;
gbcLbl.gridheight = 1;
gbcLbl.insets = new Insets(5, 5, 5, 5);
gbcLbl.anchor = GridBagConstraints.EAST;
GridBagConstraints gbcEdCtrl = new GridBagConstraints();
gbcEdCtrl.gridx = 3;
gbcEdCtrl.gridwidth = 3;
gbcEdCtrl.gridheight = 1;
gbcEdCtrl.insets = new Insets(5, 5, 5, 5);
gbcEdCtrl.anchor = GridBagConstraints.WEST;
jlEncrypt = new JLabel(res.getString("DExportPrivateKeyOpenSsl.jlEncrypt.text"));
GridBagConstraints gbc_jlEncrypt = (GridBagConstraints) gbcLbl.clone();
gbc_jlEncrypt.gridy = 0;
jcbEncrypt = new JCheckBox();
jcbEncrypt.setSelected(true);
jcbEncrypt.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jcbEncrypt.tooltip"));
GridBagConstraints gbc_jcbEncrypt = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jcbEncrypt.gridy = 0;
jcbEncrypt.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
if (jcbEncrypt.isSelected()) {
jcbExportPem.setSelected(true);
jcbExportPem.setEnabled(false);
} else {
jcbExportPem.setEnabled(true);
}
}
});
jlPbeAlg = new JLabel(res.getString("DExportPrivateKeyOpenSsl.jlPbeAlg.text"));
GridBagConstraints gbc_jlPbeAlg = (GridBagConstraints) gbcLbl.clone();
gbc_jlPbeAlg.gridy = 1;
jcbPbeAlg = new JComboBox<OpenSslPbeType>();
populatePbeAlgs();
jcbPbeAlg.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jcbPbeAlg.tooltip"));
jcbPbeAlg.setSelectedIndex(0);
GridBagConstraints gbc_jcbPbeAlg = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jcbPbeAlg.gridy = 1;
jlPassword = new JLabel(res.getString("DExportPrivateKeyOpenSsl.jlPassword.text"));
GridBagConstraints gbc_jlPassword = (GridBagConstraints) gbcLbl.clone();
gbc_jlPassword.gridy = 2;
if (passwordQualityConfig.getEnabled()) {
if (passwordQualityConfig.getEnforced()) {
jpfPassword = new JPasswordQualityField(15, passwordQualityConfig.getMinimumQuality());
} else {
jpfPassword = new JPasswordQualityField(15);
}
} else {
jpfPassword = new JPasswordField(15);
}
jpfPassword.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jpqfPassword.tooltip"));
GridBagConstraints gbc_jpfPassword = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jpfPassword.gridy = 2;
jlConfirmPassword = new JLabel(res.getString("DExportPrivateKeyOpenSsl.jlConfirmPassword.text"));
GridBagConstraints gbc_jlConfirmPassword = (GridBagConstraints) gbcLbl.clone();
gbc_jlConfirmPassword.gridy = 3;
jpfConfirmPassword = new JPasswordField(15);
jpfConfirmPassword.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jpfConfirmPassword.tooltip"));
GridBagConstraints gbc_jpfConfirmPassword = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jpfConfirmPassword.gridy = 3;
jlExportPem = new JLabel(res.getString("DExportPrivateKeyOpenSsl.jlExportPem.text"));
GridBagConstraints gbc_jlExportPem = (GridBagConstraints) gbcLbl.clone();
gbc_jlExportPem.gridy = 4;
jcbExportPem = new JCheckBox();
jcbExportPem.setSelected(true);
// Itinitla export setting is with
jcbExportPem.setEnabled(false);
// encryption - must be pem
// export
jcbExportPem.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jcbExportPem.tooltip"));
GridBagConstraints gbc_jcbExportPem = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jcbExportPem.gridy = 4;
jlExportFile = new JLabel(res.getString("DExportPrivateKeyOpenSsl.jlExportFile.text"));
GridBagConstraints gbc_jlExportFile = (GridBagConstraints) gbcLbl.clone();
gbc_jlExportFile.gridy = 5;
jtfExportFile = new JTextField(30);
jtfExportFile.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jtfExportFile.tooltip"));
GridBagConstraints gbc_jtfExportFile = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jtfExportFile.gridy = 5;
gbc_jtfExportFile.gridwidth = 6;
jbBrowse = new JButton(res.getString("DExportPrivateKeyOpenSsl.jbBrowse.text"));
jbBrowse.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jbBrowse.tooltip"));
PlatformUtil.setMnemonic(jbBrowse, res.getString("DExportPrivateKeyOpenSsl.jbBrowse.mnemonic").charAt(0));
GridBagConstraints gbc_jbBrowse = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jbBrowse.gridy = 5;
gbc_jbBrowse.gridx = 9;
jbBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DExportPrivateKeyOpenSsl.this);
browsePressed();
} finally {
CursorUtil.setCursorFree(DExportPrivateKeyOpenSsl.this);
}
}
});
jpOptions = new JPanel(new GridBagLayout());
jpOptions.setBorder(new CompoundBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()), new EmptyBorder(5, 5, 5, 5)));
jpOptions.add(jlEncrypt, gbc_jlEncrypt);
jpOptions.add(jcbEncrypt, gbc_jcbEncrypt);
jpOptions.add(jlPbeAlg, gbc_jlPbeAlg);
jpOptions.add(jcbPbeAlg, gbc_jcbPbeAlg);
jpOptions.add(jlPassword, gbc_jlPassword);
jpOptions.add(jpfPassword, gbc_jpfPassword);
jpOptions.add(jlConfirmPassword, gbc_jlConfirmPassword);
jpOptions.add(jpfConfirmPassword, gbc_jpfConfirmPassword);
jpOptions.add(jlExportPem, gbc_jlExportPem);
jpOptions.add(jcbExportPem, gbc_jcbExportPem);
jpOptions.add(jlExportFile, gbc_jlExportFile);
jpOptions.add(jtfExportFile, gbc_jtfExportFile);
jpOptions.add(jbBrowse, gbc_jbBrowse);
jcbEncrypt.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
if (jcbEncrypt.isSelected()) {
jcbPbeAlg.setEnabled(true);
jpfPassword.setEnabled(true);
jpfConfirmPassword.setEnabled(true);
} else {
jcbPbeAlg.setEnabled(false);
jpfPassword.setEnabled(false);
if (jpfPassword instanceof JPasswordQualityField) {
((JPasswordQualityField) jpfPassword).setText("");
} else {
((JPasswordField) jpfPassword).setText("");
}
jpfConfirmPassword.setEnabled(false);
jpfConfirmPassword.setText("");
}
}
});
jbExport = new JButton(res.getString("DExportPrivateKeyOpenSsl.jbExport.text"));
PlatformUtil.setMnemonic(jbExport, res.getString("DExportPrivateKeyOpenSsl.jbExport.mnemonic").charAt(0));
jbExport.setToolTipText(res.getString("DExportPrivateKeyOpenSsl.jbExport.tooltip"));
jbExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DExportPrivateKeyOpenSsl.this);
exportPressed();
} finally {
CursorUtil.setCursorFree(DExportPrivateKeyOpenSsl.this);
}
}
});
jbCancel = new JButton(res.getString("DExportPrivateKeyOpenSsl.jbCancel.text"));
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jpButtons = PlatformUtil.createDialogButtonPanel(jbExport, jbCancel, false);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(jpOptions, BorderLayout.CENTER);
getContentPane().add(jpButtons, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
setTitle(MessageFormat.format(res.getString("DExportPrivateKeyOpenSsl.Title"), entryAlias));
setResizable(false);
getRootPane().setDefaultButton(jbExport);
populateExportFileName();
pack();
}
use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.
the class DExportPrivateKeyPkcs8 method initComponents.
private void initComponents() {
GridBagConstraints gbcLbl = new GridBagConstraints();
gbcLbl.gridx = 0;
gbcLbl.gridwidth = 3;
gbcLbl.gridheight = 1;
gbcLbl.insets = new Insets(5, 5, 5, 5);
gbcLbl.anchor = GridBagConstraints.EAST;
GridBagConstraints gbcEdCtrl = new GridBagConstraints();
gbcEdCtrl.gridx = 3;
gbcEdCtrl.gridwidth = 3;
gbcEdCtrl.gridheight = 1;
gbcEdCtrl.insets = new Insets(5, 5, 5, 5);
gbcEdCtrl.anchor = GridBagConstraints.WEST;
jlEncrypt = new JLabel(res.getString("DExportPrivateKeyPkcs8.jlEncrypt.text"));
GridBagConstraints gbc_jlEncrypt = (GridBagConstraints) gbcLbl.clone();
gbc_jlEncrypt.gridy = 0;
jcbEncrypt = new JCheckBox();
jcbEncrypt.setSelected(true);
jcbEncrypt.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jcbEncrypt.tooltip"));
GridBagConstraints gbc_jcbEncrypt = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jcbEncrypt.gridy = 0;
jlPbeAlg = new JLabel(res.getString("DExportPrivateKeyPkcs8.jlPbeAlg.text"));
GridBagConstraints gbc_jlPbeAlg = (GridBagConstraints) gbcLbl.clone();
gbc_jlPbeAlg.gridy = 1;
jcbPbeAlg = new JComboBox<Pkcs8PbeType>();
populatePbeAlgs();
jcbPbeAlg.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jcbPbeAlg.tooltip"));
jcbPbeAlg.setSelectedIndex(0);
GridBagConstraints gbc_jcbPbeAlg = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jcbPbeAlg.gridy = 1;
jlPassword = new JLabel(res.getString("DExportPrivateKeyPkcs8.jlPassword.text"));
GridBagConstraints gbc_jlPassword = (GridBagConstraints) gbcLbl.clone();
gbc_jlPassword.gridy = 2;
if (passwordQualityConfig.getEnabled()) {
if (passwordQualityConfig.getEnforced()) {
jpfPassword = new JPasswordQualityField(15, passwordQualityConfig.getMinimumQuality());
} else {
jpfPassword = new JPasswordQualityField(15);
}
} else {
jpfPassword = new JPasswordField(15);
}
jpfPassword.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jpqfPassword.tooltip"));
GridBagConstraints gbc_jpfPassword = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jpfPassword.gridy = 2;
jlConfirmPassword = new JLabel(res.getString("DExportPrivateKeyPkcs8.jlConfirmPassword.text"));
GridBagConstraints gbc_jlConfirmPassword = (GridBagConstraints) gbcLbl.clone();
gbc_jlConfirmPassword.gridy = 3;
jpfConfirmPassword = new JPasswordField(15);
jpfConfirmPassword.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jpfConfirmPassword.tooltip"));
GridBagConstraints gbc_jpfConfirmPassword = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jpfConfirmPassword.gridy = 3;
jlExportPem = new JLabel(res.getString("DExportPrivateKeyPkcs8.jlExportPem.text"));
GridBagConstraints gbc_jlExportPem = (GridBagConstraints) gbcLbl.clone();
gbc_jlExportPem.gridy = 4;
jcbExportPem = new JCheckBox();
jcbExportPem.setSelected(true);
jcbExportPem.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jcbExportPem.tooltip"));
GridBagConstraints gbc_jcbExportPem = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jcbExportPem.gridy = 4;
jlExportFile = new JLabel(res.getString("DExportPrivateKeyPkcs8.jlExportFile.text"));
GridBagConstraints gbc_jlExportFile = (GridBagConstraints) gbcLbl.clone();
gbc_jlExportFile.gridy = 5;
jtfExportFile = new JTextField(30);
jtfExportFile.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jtfExportFile.tooltip"));
GridBagConstraints gbc_jtfExportFile = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jtfExportFile.gridy = 5;
gbc_jtfExportFile.gridwidth = 6;
jbBrowse = new JButton(res.getString("DExportPrivateKeyPkcs8.jbBrowse.text"));
jbBrowse.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jbBrowse.tooltip"));
PlatformUtil.setMnemonic(jbBrowse, res.getString("DExportPrivateKeyPkcs8.jbBrowse.mnemonic").charAt(0));
GridBagConstraints gbc_jbBrowse = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jbBrowse.gridy = 5;
gbc_jbBrowse.gridx = 9;
jbBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DExportPrivateKeyPkcs8.this);
browsePressed();
} finally {
CursorUtil.setCursorFree(DExportPrivateKeyPkcs8.this);
}
}
});
jpOptions = new JPanel(new GridBagLayout());
jpOptions.setBorder(new CompoundBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()), new EmptyBorder(5, 5, 5, 5)));
jpOptions.add(jlEncrypt, gbc_jlEncrypt);
jpOptions.add(jcbEncrypt, gbc_jcbEncrypt);
jpOptions.add(jlPbeAlg, gbc_jlPbeAlg);
jpOptions.add(jcbPbeAlg, gbc_jcbPbeAlg);
jpOptions.add(jlPassword, gbc_jlPassword);
jpOptions.add(jpfPassword, gbc_jpfPassword);
jpOptions.add(jlConfirmPassword, gbc_jlConfirmPassword);
jpOptions.add(jpfConfirmPassword, gbc_jpfConfirmPassword);
jpOptions.add(jlExportPem, gbc_jlExportPem);
jpOptions.add(jcbExportPem, gbc_jcbExportPem);
jpOptions.add(jlExportFile, gbc_jlExportFile);
jpOptions.add(jtfExportFile, gbc_jtfExportFile);
jpOptions.add(jbBrowse, gbc_jbBrowse);
jcbEncrypt.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
if (jcbEncrypt.isSelected()) {
jcbPbeAlg.setEnabled(true);
jpfPassword.setEnabled(true);
jpfConfirmPassword.setEnabled(true);
} else {
jcbPbeAlg.setEnabled(false);
jpfPassword.setEnabled(false);
if (jpfPassword instanceof JPasswordQualityField) {
((JPasswordQualityField) jpfPassword).setText("");
} else {
((JPasswordField) jpfPassword).setText("");
}
jpfConfirmPassword.setEnabled(false);
jpfConfirmPassword.setText("");
}
}
});
jbExport = new JButton(res.getString("DExportPrivateKeyPkcs8.jbExport.text"));
PlatformUtil.setMnemonic(jbExport, res.getString("DExportPrivateKeyPkcs8.jbExport.mnemonic").charAt(0));
jbExport.setToolTipText(res.getString("DExportPrivateKeyPkcs8.jbExport.tooltip"));
jbExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DExportPrivateKeyPkcs8.this);
exportPressed();
} finally {
CursorUtil.setCursorFree(DExportPrivateKeyPkcs8.this);
}
}
});
jbCancel = new JButton(res.getString("DExportPrivateKeyPkcs8.jbCancel.text"));
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jpButtons = PlatformUtil.createDialogButtonPanel(jbExport, jbCancel, false);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(jpOptions, BorderLayout.CENTER);
getContentPane().add(jpButtons, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
setTitle(MessageFormat.format(res.getString("DExportPrivateKeyPkcs8.Title"), entryAlias));
setResizable(false);
getRootPane().setDefaultButton(jbExport);
populateExportFileName();
pack();
}
use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.
the class DExportPrivateKeyPvk method initComponents.
private void initComponents() {
GridBagConstraints gbcLbl = new GridBagConstraints();
gbcLbl.gridx = 0;
gbcLbl.gridwidth = 3;
gbcLbl.gridheight = 1;
gbcLbl.insets = new Insets(5, 5, 5, 5);
gbcLbl.anchor = GridBagConstraints.EAST;
GridBagConstraints gbcEdCtrl = new GridBagConstraints();
gbcEdCtrl.gridx = 3;
gbcEdCtrl.gridwidth = 3;
gbcEdCtrl.gridheight = 1;
gbcEdCtrl.insets = new Insets(5, 5, 5, 5);
gbcEdCtrl.anchor = GridBagConstraints.WEST;
jlKeyType = new JLabel(res.getString("DExportPrivateKeyPvk.jlKeyType.text"));
GridBagConstraints gbc_jlKeyType = (GridBagConstraints) gbcLbl.clone();
gbc_jlKeyType.gridy = 0;
jrbExchange = new JRadioButton(res.getString("DExportPrivateKeyPvk.jrbExchange.text"));
jrbExchange.setToolTipText(res.getString("DExportPrivateKeyPvk.jrbExchange.tooltip"));
PlatformUtil.setMnemonic(jrbExchange, res.getString("DExportPrivateKeyPvk.jrbExchange.mnemonic").charAt(0));
jrbExchange.setSelected(true);
GridBagConstraints gbc_jrbExchange = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jrbExchange.gridy = 0;
jrbSignature = new JRadioButton(res.getString("DExportPrivateKeyPvk.jrbSignature.text"));
jrbSignature.setToolTipText(res.getString("DExportPrivateKeyPvk.jrbSignature.tooltip"));
PlatformUtil.setMnemonic(jrbSignature, res.getString("DExportPrivateKeyPvk.jrbSignature.mnemonic").charAt(0));
GridBagConstraints gbc_jrbSignature = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jrbSignature.gridy = 0;
gbc_jrbSignature.gridx = 6;
ButtonGroup keyTypes = new ButtonGroup();
keyTypes.add(jrbExchange);
keyTypes.add(jrbSignature);
if (privateKey instanceof DSAPrivateKey) {
jrbSignature.setSelected(true);
jrbExchange.setEnabled(false);
jrbSignature.setEnabled(false);
}
jlEncrypt = new JLabel(res.getString("DExportPrivateKeyPvk.jlEncrypt.text"));
GridBagConstraints gbc_jlEncrypt = (GridBagConstraints) gbcLbl.clone();
gbc_jlEncrypt.gridy = 1;
jcbEncrypt = new JCheckBox();
jcbEncrypt.setSelected(true);
jcbEncrypt.setToolTipText(res.getString("DExportPrivateKeyPvk.jcbEncrypt.tooltip"));
GridBagConstraints gbc_jcbEncrypt = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jcbEncrypt.gridy = 1;
jlEncryptionStrength = new JLabel(res.getString("DExportPrivateKeyPvk.jlEncryptionStrength.text"));
GridBagConstraints gbc_jlEncryptionStrength = (GridBagConstraints) gbcLbl.clone();
gbc_jlEncryptionStrength.gridy = 2;
jrbStrong = new JRadioButton(res.getString("DExportPrivateKeyPvk.jrbStrong.text"));
jrbStrong.setToolTipText(res.getString("DExportPrivateKeyPvk.jrbStrong.tooltip"));
PlatformUtil.setMnemonic(jrbStrong, res.getString("DExportPrivateKeyPvk.jrbStrong.mnemonic").charAt(0));
jrbStrong.setSelected(true);
GridBagConstraints gbc_jrbStrong = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jrbStrong.gridy = 2;
jrbWeak = new JRadioButton(res.getString("DExportPrivateKeyPvk.jrbWeak.text"));
jrbWeak.setToolTipText(res.getString("DExportPrivateKeyPvk.jrbWeak.tooltip"));
PlatformUtil.setMnemonic(jrbWeak, res.getString("DExportPrivateKeyPvk.jrbWeak.mnemonic").charAt(0));
GridBagConstraints gbc_jrbWeak = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jrbWeak.gridy = 2;
gbc_jrbWeak.gridx = 6;
ButtonGroup encryptionStrengths = new ButtonGroup();
encryptionStrengths.add(jrbStrong);
encryptionStrengths.add(jrbWeak);
jlPassword = new JLabel(res.getString("DExportPrivateKeyPvk.jlPassword.text"));
GridBagConstraints gbc_jlPassword = (GridBagConstraints) gbcLbl.clone();
gbc_jlPassword.gridy = 3;
if (passwordQualityConfig.getEnabled()) {
if (passwordQualityConfig.getEnforced()) {
jpfPassword = new JPasswordQualityField(15, passwordQualityConfig.getMinimumQuality());
} else {
jpfPassword = new JPasswordQualityField(15);
}
} else {
jpfPassword = new JPasswordField(15);
}
jpfPassword.setToolTipText(res.getString("DExportPrivateKeyPvk.jpqfPassword.tooltip"));
GridBagConstraints gbc_jpfPassword = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jpfPassword.gridy = 3;
gbc_jpfPassword.gridwidth = 6;
jlConfirmPassword = new JLabel(res.getString("DExportPrivateKeyPvk.jlConfirmPassword.text"));
GridBagConstraints gbc_jlConfirmPassword = (GridBagConstraints) gbcLbl.clone();
gbc_jlConfirmPassword.gridy = 4;
jpfConfirmPassword = new JPasswordField(15);
jpfConfirmPassword.setToolTipText(res.getString("DExportPrivateKeyPvk.jpfConfirmPassword.tooltip"));
GridBagConstraints gbc_jpfConfirmPassword = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jpfConfirmPassword.gridy = 4;
gbc_jpfConfirmPassword.gridwidth = 6;
jlExportFile = new JLabel(res.getString("DExportPrivateKeyPvk.jlExportFile.text"));
GridBagConstraints gbc_jlExportFile = (GridBagConstraints) gbcLbl.clone();
gbc_jlExportFile.gridy = 5;
jtfExportFile = new JTextField(30);
jtfExportFile.setToolTipText(res.getString("DExportPrivateKeyPvk.jtfExportFile.tooltip"));
GridBagConstraints gbc_jtfExportFile = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jtfExportFile.gridy = 5;
gbc_jtfExportFile.gridwidth = 6;
jbBrowse = new JButton(res.getString("DExportPrivateKeyPvk.jbBrowse.text"));
jbBrowse.setToolTipText(res.getString("DExportPrivateKeyPvk.jbBrowse.tooltip"));
PlatformUtil.setMnemonic(jbBrowse, res.getString("DExportPrivateKeyPvk.jbBrowse.mnemonic").charAt(0));
GridBagConstraints gbc_jbBrowse = (GridBagConstraints) gbcEdCtrl.clone();
gbc_jbBrowse.gridy = 5;
gbc_jbBrowse.gridx = 9;
jbBrowse.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DExportPrivateKeyPvk.this);
browsePressed();
} finally {
CursorUtil.setCursorFree(DExportPrivateKeyPvk.this);
}
}
});
jpOptions = new JPanel(new GridBagLayout());
jpOptions.setBorder(new CompoundBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()), new EmptyBorder(5, 5, 5, 5)));
jpOptions.add(jlKeyType, gbc_jlKeyType);
jpOptions.add(jrbExchange, gbc_jrbExchange);
jpOptions.add(jrbSignature, gbc_jrbSignature);
jpOptions.add(jlEncrypt, gbc_jlEncrypt);
jpOptions.add(jcbEncrypt, gbc_jcbEncrypt);
jpOptions.add(jrbStrong, gbc_jrbStrong);
jpOptions.add(jrbWeak, gbc_jrbWeak);
jpOptions.add(jlEncryptionStrength, gbc_jlEncryptionStrength);
jpOptions.add(jlEncryptionStrength, gbc_jlEncryptionStrength);
jpOptions.add(jlPassword, gbc_jlPassword);
jpOptions.add(jpfPassword, gbc_jpfPassword);
jpOptions.add(jlConfirmPassword, gbc_jlConfirmPassword);
jpOptions.add(jpfConfirmPassword, gbc_jpfConfirmPassword);
jpOptions.add(jlExportFile, gbc_jlExportFile);
jpOptions.add(jtfExportFile, gbc_jtfExportFile);
jpOptions.add(jbBrowse, gbc_jbBrowse);
jcbEncrypt.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
if (jcbEncrypt.isSelected()) {
jrbStrong.setEnabled(true);
jrbWeak.setEnabled(true);
jpfPassword.setEnabled(true);
jpfConfirmPassword.setEnabled(true);
} else {
jrbStrong.setEnabled(false);
jrbWeak.setEnabled(false);
jpfPassword.setEnabled(false);
if (jpfPassword instanceof JPasswordQualityField) {
((JPasswordQualityField) jpfPassword).setText("");
} else {
((JPasswordField) jpfPassword).setText("");
}
jpfConfirmPassword.setEnabled(false);
jpfConfirmPassword.setText("");
}
}
});
jbExport = new JButton(res.getString("DExportPrivateKeyPvk.jbExport.text"));
PlatformUtil.setMnemonic(jbExport, res.getString("DExportPrivateKeyPvk.jbExport.mnemonic").charAt(0));
jbExport.setToolTipText(res.getString("DExportPrivateKeyPvk.jbExport.tooltip"));
jbExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
try {
CursorUtil.setCursorBusy(DExportPrivateKeyPvk.this);
exportPressed();
} finally {
CursorUtil.setCursorFree(DExportPrivateKeyPvk.this);
}
}
});
jbCancel = new JButton(res.getString("DExportPrivateKeyPvk.jbCancel.text"));
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jpButtons = PlatformUtil.createDialogButtonPanel(jbExport, jbCancel, false);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(jpOptions, BorderLayout.CENTER);
getContentPane().add(jpButtons, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
setTitle(MessageFormat.format(res.getString("DExportPrivateKeyPvk.Title"), entryAlias));
setResizable(false);
getRootPane().setDefaultButton(jbExport);
populateExportFileName();
pack();
}
use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.
the class DGenerateKeyPair method initComponents.
private void initComponents() {
jlRSAKeySize = new JLabel(res.getString("DGenerateKeyPair.jlKeySize.text"));
jspRSAKeySize = new JSpinner();
jspRSAKeySize.setToolTipText(res.getString("DGenerateKeyPair.jsKeySize.tooltip"));
jlDSAKeySize = new JLabel(res.getString("DGenerateKeyPair.jlKeySize.text"));
jspDSAKeySize = new JSpinner();
jspDSAKeySize.setToolTipText(res.getString("DGenerateKeyPair.jsKeySize.tooltip"));
jrbRSA = new JRadioButton(res.getString("DGenerateKeyPair.jrbRSA.text"), false);
PlatformUtil.setMnemonic(jrbRSA, res.getString("DGenerateKeyPair.jrbRSA.mnemonic").charAt(0));
jrbRSA.setToolTipText(res.getString("DGenerateKeyPair.jrbRSA.tooltip"));
jrbDSA = new JRadioButton(res.getString("DGenerateKeyPair.jrbDSA.text"), true);
PlatformUtil.setMnemonic(jrbDSA, res.getString("DGenerateKeyPair.jrbDSA.mnemonic").charAt(0));
jrbDSA.setToolTipText(res.getString("DGenerateKeyPair.jrbDSA.tooltip"));
jrbEC = new JRadioButton(res.getString("DGenerateKeyPair.jrbEC.text"), true);
PlatformUtil.setMnemonic(jrbEC, res.getString("DGenerateKeyPair.jrbEC.mnemonic").charAt(0));
// EC available?
if (EccUtil.isECAvailable(keyStoreType)) {
jrbEC.setEnabled(true);
jrbEC.setToolTipText(res.getString("DGenerateKeyPair.jrbEC.tooltip"));
} else {
jrbEC.setEnabled(false);
jrbEC.setToolTipText(res.getString("DGenerateKeyPair.jrbEC.na.tooltip"));
}
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(jrbRSA);
buttonGroup.add(jrbDSA);
buttonGroup.add(jrbEC);
jlECCurveSet = new JLabel(res.getString("DGenerateKeyPair.jlECCurveSet.text"));
jlECCurveSet.setToolTipText(res.getString("DGenerateKeyPair.jlECCurveSet.tooltip"));
jcbECCurveSet = new JComboBox<String>();
jcbECCurveSet.setModel(new DefaultComboBoxModel<String>(CurveSet.getAvailableSetNames(keyStoreType)));
jcbECCurveSet.setToolTipText(res.getString("DGenerateKeyPair.jcbECCurveSet.tooltip"));
jlECCurve = new JLabel(res.getString("DGenerateKeyPair.jlECCurve.text"));
jlECCurve.setToolTipText(res.getString("DGenerateKeyPair.jlECCurve.tooltip"));
jcbECCurve = new JComboBox<String>();
// make combo box wide enough for longest curve name
jcbECCurve.setPrototypeDisplayValue(EccUtil.findLongestCurveName());
jcbECCurve.setToolTipText(res.getString("DGenerateKeyPair.jcbECCurve.tooltip"));
jbCancel = new JButton(res.getString("DGenerateKeyPair.jbCancel.text"));
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jbOK = new JButton(res.getString("DGenerateKeyPair.jbOK.text"));
if (keyPairType == KeyPairType.RSA) {
jrbRSA.setSelected(true);
} else if (keyPairType == KeyPairType.DSA) {
jrbDSA.setSelected(true);
} else {
if (jrbEC.isEnabled()) {
jrbDSA.setSelected(true);
} else {
// EC not available => fall back to RSA
jrbRSA.setSelected(true);
}
}
loadKeySizes(keyPairSize);
loadECNamedCurves((String) jcbECCurveSet.getModel().getSelectedItem());
enableDisableElements();
JPanel jpContent = new JPanel();
jpContent.setBorder(new TitledBorder(new EtchedBorder(), res.getString("DGenerateKeyPair.jpContent.text")));
// jpContent.setBorder(BorderFactory.createTitledBorder(res.getString("DGenerateKeyPair.jpContent.text")));
JPanel buttons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel);
// layout
getContentPane().setLayout(new MigLayout("fill", "", "para[]"));
getContentPane().add(jpContent, "wrap unrel");
getContentPane().add(buttons, "growx");
jpContent.setLayout(new MigLayout("insets dialog, ", "[][right][]", "[]unrel[]"));
jpContent.add(jrbRSA, "");
jpContent.add(jlRSAKeySize, "");
jpContent.add(jspRSAKeySize, "growx, wrap");
jpContent.add(jrbDSA, "");
jpContent.add(jlDSAKeySize, "");
jpContent.add(jspDSAKeySize, "growx, wrap");
jpContent.add(jrbEC, "");
jpContent.add(jlECCurveSet, "");
jpContent.add(jcbECCurveSet, "growx, wrap");
jpContent.add(jlECCurve, "skip");
jpContent.add(jcbECCurve, "growx");
jcbECCurveSet.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
loadECNamedCurves((String) jcbECCurveSet.getModel().getSelectedItem());
}
});
jrbRSA.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
enableDisableElements();
}
});
jrbDSA.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
enableDisableElements();
}
});
jrbEC.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
enableDisableElements();
}
});
jspRSAKeySize.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
correctKeyPairSize();
}
});
jspDSAKeySize.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
correctKeyPairSize();
}
});
jbOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
okPressed();
}
});
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
setResizable(false);
getRootPane().setDefaultButton(jbOK);
pack();
}
use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.
the class DGenerateSecretKey method initComponents.
private void initComponents() {
jlKeySize = new JLabel(res.getString("DGenerateSecretKey.jlKeySize.text"));
jsKeySize = new JSpinner();
jsKeySize.setToolTipText(res.getString("DGenerateSecretKey.jsKeySize.tooltip"));
jpKeySize = new JPanel(new FlowLayout(FlowLayout.LEFT));
jpKeySize.add(jlKeySize);
jpKeySize.add(jsKeySize);
jlKeyAlg = new JLabel(res.getString("DGenerateSecretKey.jlKeyAlg.text"));
jcbKeyAlg = new JComboBox<SecretKeyType>();
jcbKeyAlg.setToolTipText(res.getString("DGenerateSecretKey.jcbKeyAlg.tooltip"));
populateKeyAlgs();
loadKeySizes(secretKeySize);
jcbKeyAlg.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
loadKeySizes(getSecretKeySize());
}
});
jpKeyAlg = new JPanel(new FlowLayout(FlowLayout.LEFT));
jpKeyAlg.add(jlKeyAlg);
jpKeyAlg.add(jcbKeyAlg);
jsKeySize.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
correctSecretKeySize();
}
});
jpOptions = new JPanel(new GridLayout(2, 1, 5, 5));
jpOptions.add(jpKeyAlg);
jpOptions.add(jpKeySize);
jpOptions.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()));
jbOK = new JButton(res.getString("DGenerateSecretKey.jbOK.text"));
jbOK.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
okPressed();
}
});
jbCancel = new JButton(res.getString("DGenerateSecretKey.jbCancel.text"));
jbCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent evt) {
cancelPressed();
}
});
jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel, false);
getContentPane().setLayout(new BorderLayout());
getContentPane().add(jpOptions, BorderLayout.CENTER);
getContentPane().add(jpButtons, BorderLayout.SOUTH);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
closeDialog();
}
});
setResizable(false);
getRootPane().setDefaultButton(jbOK);
pack();
}
Aggregations