Search in sources :

Example 21 with EtchedBorder

use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.

the class DImportKeyPairPvk 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;
    jlEncrypted = new JLabel(res.getString("DImportKeyPairPvk.jlEncrypted.text"));
    GridBagConstraints gbc_jlEncrypted = (GridBagConstraints) gbcLbl.clone();
    gbc_jlEncrypted.gridy = 0;
    jcbEncrypted = new JCheckBox();
    jcbEncrypted.setSelected(true);
    jcbEncrypted.setToolTipText(res.getString("DImportKeyPairPvk.jcbEncrypted.tooltip"));
    GridBagConstraints gbc_jcbEncrypted = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jcbEncrypted.gridy = 0;
    jlPassword = new JLabel(res.getString("DImportKeyPairPvk.jlPassword.text"));
    GridBagConstraints gbc_jlPassword = (GridBagConstraints) gbcLbl.clone();
    gbc_jlPassword.gridy = 1;
    jpfPassword = new JPasswordField(15);
    jpfPassword.setToolTipText(res.getString("DImportKeyPairPvk.jpfPassword.tooltip"));
    GridBagConstraints gbc_jpfPassword = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jpfPassword.gridy = 1;
    jlPrivateKey = new JLabel(res.getString("DImportKeyPairPvk.jlPrivateKey.text"));
    GridBagConstraints gbc_jlPrivateKey = (GridBagConstraints) gbcLbl.clone();
    gbc_jlPrivateKey.gridy = 2;
    jtfPrivateKeyPath = new JTextField(30);
    jtfPrivateKeyPath.setToolTipText(res.getString("DImportKeyPairPvk.jtfPrivateKeyPath.tooltip"));
    GridBagConstraints gbc_jtfPrivateKeyPath = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jtfPrivateKeyPath.gridy = 2;
    gbc_jtfPrivateKeyPath.gridwidth = 6;
    jbPrivateKeyBrowse = new JButton(res.getString("DImportKeyPairPvk.jbPrivateKeyBrowse.text"));
    PlatformUtil.setMnemonic(jbPrivateKeyBrowse, res.getString("DImportKeyPairPvk.jbPrivateKeyBrowse.mnemonic").charAt(0));
    jbPrivateKeyBrowse.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPvk.this);
                privateKeyBrowsePressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPvk.this);
            }
        }
    });
    jbPrivateKeyBrowse.setToolTipText(res.getString("DImportKeyPairPvk.jbPrivateKeyBrowse.tooltip"));
    GridBagConstraints gbc_jbPrivateKeyBrowse = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbPrivateKeyBrowse.gridy = 2;
    gbc_jbPrivateKeyBrowse.gridx = 9;
    jbPrivateKeyDetails = new JButton(res.getString("DImportKeyPairPvk.jbPrivateKeyDetails.text"));
    jbPrivateKeyDetails.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPvk.this);
                privateKeyDetailsPressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPvk.this);
            }
        }
    });
    PlatformUtil.setMnemonic(jbPrivateKeyDetails, res.getString("DImportKeyPairPvk.jbPrivateKeyDetails.mnemonic").charAt(0));
    jbPrivateKeyDetails.setToolTipText(res.getString("DImportKeyPairPvk.jbPrivateKeyDetails.tooltip"));
    GridBagConstraints gbc_jbPrivateKeyDetails = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbPrivateKeyDetails.gridy = 2;
    gbc_jbPrivateKeyDetails.gridx = 12;
    jlCertificate = new JLabel(res.getString("DImportKeyPairPvk.jlCertificate.text"));
    GridBagConstraints gbc_jlCertificate = (GridBagConstraints) gbcLbl.clone();
    gbc_jlCertificate.gridy = 3;
    jtfCertificatePath = new JTextField(30);
    jtfCertificatePath.setToolTipText(res.getString("DImportKeyPairPvk.jtfCertificatePath.tooltip"));
    GridBagConstraints gbc_jtfCertificatePath = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jtfCertificatePath.gridy = 3;
    gbc_jtfCertificatePath.gridwidth = 6;
    jbCertificateBrowse = new JButton(res.getString("DImportKeyPairPvk.jbCertificateBrowse.text"));
    jbCertificateBrowse.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPvk.this);
                certificateBrowsePressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPvk.this);
            }
        }
    });
    PlatformUtil.setMnemonic(jbCertificateBrowse, res.getString("DImportKeyPairPvk.jbCertificateBrowse.mnemonic").charAt(0));
    jbCertificateBrowse.setToolTipText(res.getString("DImportKeyPairPvk.jbCertificateBrowse.tooltip"));
    GridBagConstraints gbc_jbCertificateBrowse = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbCertificateBrowse.gridy = 3;
    gbc_jbCertificateBrowse.gridx = 9;
    jbCertificateDetails = new JButton(res.getString("DImportKeyPairPvk.jbCertificateDetails.text"));
    jbCertificateDetails.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPvk.this);
                certificateDetailsPressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPvk.this);
            }
        }
    });
    PlatformUtil.setMnemonic(jbCertificateDetails, res.getString("DImportKeyPairPvk.jbCertificateDetails.mnemonic").charAt(0));
    jbCertificateDetails.setToolTipText(res.getString("DImportKeyPairPvk.jbCertificateDetails.tooltip"));
    GridBagConstraints gbc_jbCertificateDetails = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbCertificateDetails.gridy = 3;
    gbc_jbCertificateDetails.gridx = 12;
    jpKeyPair = new JPanel(new GridBagLayout());
    jpKeyPair.setBorder(new CompoundBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()), new EmptyBorder(5, 5, 5, 5)));
    jpKeyPair.add(jlEncrypted, gbc_jlEncrypted);
    jpKeyPair.add(jcbEncrypted, gbc_jcbEncrypted);
    jpKeyPair.add(jlPassword, gbc_jlPassword);
    jpKeyPair.add(jpfPassword, gbc_jpfPassword);
    jpKeyPair.add(jlPrivateKey, gbc_jlPrivateKey);
    jpKeyPair.add(jtfPrivateKeyPath, gbc_jtfPrivateKeyPath);
    jpKeyPair.add(jbPrivateKeyBrowse, gbc_jbPrivateKeyBrowse);
    jpKeyPair.add(jbPrivateKeyDetails, gbc_jbPrivateKeyDetails);
    jpKeyPair.add(jlCertificate, gbc_jlCertificate);
    jpKeyPair.add(jtfCertificatePath, gbc_jtfCertificatePath);
    jpKeyPair.add(jbCertificateBrowse, gbc_jbCertificateBrowse);
    jpKeyPair.add(jbCertificateDetails, gbc_jbCertificateDetails);
    jcbEncrypted.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            if (jcbEncrypted.isSelected()) {
                jpfPassword.setEnabled(true);
            } else {
                jpfPassword.setEnabled(false);
                jpfPassword.setText("");
            }
        }
    });
    jbImport = new JButton(res.getString("DImportKeyPairPvk.jbImport.text"));
    PlatformUtil.setMnemonic(jbImport, res.getString("DImportKeyPairPvk.jbImport.mnemonic").charAt(0));
    jbImport.setToolTipText(res.getString("DImportKeyPairPvk.jbImport.tooltip"));
    jbImport.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPvk.this);
                importPressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPvk.this);
            }
        }
    });
    jbCancel = new JButton(res.getString("DImportKeyPairPvk.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(jbImport, jbCancel, false);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(jpKeyPair, BorderLayout.CENTER);
    getContentPane().add(jpButtons, BorderLayout.SOUTH);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    setTitle(res.getString("DImportKeyPairPvk.Title"));
    setResizable(false);
    getRootPane().setDefaultButton(jbImport);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) ItemEvent(java.awt.event.ItemEvent) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) JPasswordField(javax.swing.JPasswordField) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) ItemListener(java.awt.event.ItemListener) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction)

Example 22 with EtchedBorder

use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.

the class DSignCsr method initComponents.

private void initComponents() throws CryptoException {
    jlCsrFormat = new JLabel(res.getString("DSignCsr.jlCsrFormat.text"));
    jtfCsrFormat = new JTextField(15);
    jtfCsrFormat.setEditable(false);
    jtfCsrFormat.setToolTipText(res.getString("DSignCsr.jtfCsrFormat.tooltip"));
    jlCsrSubject = new JLabel(res.getString("DSignCsr.jlCsrSubject.text"));
    jdnCsrSubject = new JDistinguishedName(res.getString("DSignCsr.Subject.Title"), 30, false);
    jdnCsrSubject.setToolTipText(res.getString("DSignCsr.jdnCsrSubject.tooltip"));
    jlCsrPublicKey = new JLabel(res.getString("DSignCsr.jlCsrPublicKey.text"));
    jtfCsrPublicKey = new JTextField(15);
    jtfCsrPublicKey.setEditable(false);
    jtfCsrPublicKey.setToolTipText(res.getString("DSignCsr.jtfCsrPublicKey.tooltip"));
    jbViewCsrPublicKeyDetails = new JButton();
    jbViewCsrPublicKeyDetails.setToolTipText(res.getString("DSignCsr.jbViewCsrPublicKeyDetails.tooltip"));
    jbViewCsrPublicKeyDetails.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("DSignCsr.jbViewCsrPublicKeyDetails.image")))));
    jlCsrSignatureAlgorithm = new JLabel(res.getString("DSignCsr.jlCsrSignatureAlgorithm.text"));
    jtfCsrSignatureAlgorithm = new JTextField(15);
    jtfCsrSignatureAlgorithm.setEditable(false);
    jtfCsrSignatureAlgorithm.setToolTipText(res.getString("DSignCsr.jtfCsrSignatureAlgorithm.tooltip"));
    jlCsrChallenge = new JLabel(res.getString("DSignCsr.jlCsrChallenge.text"));
    jtfCsrChallenge = new JTextField(15);
    jtfCsrChallenge.setEditable(false);
    jtfCsrChallenge.setToolTipText(res.getString("DSignCsr.jtfCsrChallenge.tooltip"));
    populateCsrDetails();
    jlVersion = new JLabel(res.getString("DSignCsr.jlVersion.text"));
    jrbVersion1 = new JRadioButton(res.getString("DSignCsr.jrbVersion1.text"));
    jrbVersion1.setToolTipText(res.getString("DSignCsr.jrbVersion1.tooltip"));
    jrbVersion3 = new JRadioButton(res.getString("DSignCsr.jrbVersion3.text"));
    jrbVersion3.setToolTipText(res.getString("DSignCsr.jrbVersion3.tooltip"));
    jlSignatureAlgorithm = new JLabel(res.getString("DSignCsr.jlSignatureAlgorithm.text"));
    jcbSignatureAlgorithm = new JComboBox<SignatureType>();
    jcbSignatureAlgorithm.setMaximumRowCount(10);
    DialogHelper.populateSigAlgs(signKeyPairType, this.signPrivateKey, provider, jcbSignatureAlgorithm);
    jcbSignatureAlgorithm.setToolTipText(res.getString("DSignCsr.jcbSignatureAlgorithm.tooltip"));
    Date now = new Date();
    jlValidityStart = new JLabel(res.getString("DSignCsr.jlValidityStart.text"));
    jdtValidityStart = new JDateTime(res.getString("DSignCsr.jdtValidityStart.text"), false);
    jdtValidityStart.setDateTime(now);
    jdtValidityStart.setToolTipText(res.getString("DSignCsr.jdtValidityStart.tooltip"));
    jlValidityEnd = new JLabel(res.getString("DSignCsr.jlValidityEnd.text"));
    jdtValidityEnd = new JDateTime(res.getString("DSignCsr.jdtValidityEnd.text"), false);
    jdtValidityEnd.setDateTime(new Date(now.getTime() + TimeUnit.DAYS.toMillis(365)));
    jdtValidityEnd.setToolTipText(res.getString("DSignCsr.jdtValidityEnd.tooltip"));
    jlValidityPeriod = new JLabel(res.getString("DSignCsr.jlValidityPeriod.text"));
    jvpValidityPeriod = new JValidityPeriod(JValidityPeriod.YEARS);
    jvpValidityPeriod.setToolTipText(res.getString("DSignCsr.jvpValidityPeriod.tooltip"));
    jvpValidityPeriod.addApplyActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            Date startDate = jdtValidityStart.getDateTime();
            if (startDate == null) {
                startDate = new Date();
                jdtValidityStart.setDateTime(startDate);
            }
            Date validityEnd = jvpValidityPeriod.getValidityEnd(startDate);
            jdtValidityEnd.setDateTime(validityEnd);
        }
    });
    jlSerialNumber = new JLabel(res.getString("DSignCsr.jlSerialNumber.text"));
    jtfSerialNumber = new JTextField("" + generateSerialNumber(), 15);
    jtfSerialNumber.setToolTipText(res.getString("DSignCsr.jtfSerialNumber.tooltip"));
    jlCaReplyFile = new JLabel(res.getString("DSignCsr.jlCaReplyFile.text"));
    jtfCaReplyFile = new JTextField(30);
    jtfCaReplyFile.setToolTipText(res.getString("DSignCsr.jtfCaReplyFile.tooltip"));
    populateCaReplyFileName();
    jbBrowse = new JButton(res.getString("DSignCsr.jbBrowse.text"));
    jbBrowse.setToolTipText(res.getString("DSignCsr.jbBrowse.tooltip"));
    PlatformUtil.setMnemonic(jbBrowse, res.getString("DSignCsr.jbBrowse.mnemonic").charAt(0));
    jbBrowse.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DSignCsr.this);
                browsePressed();
            } finally {
                CursorUtil.setCursorFree(DSignCsr.this);
            }
        }
    });
    jbAddExtensions = new JButton(res.getString("DSignCsr.jbAddExtensions.text"));
    jbAddExtensions.setMnemonic(res.getString("DSignCsr.jbAddExtensions.mnemonic").charAt(0));
    jbAddExtensions.setToolTipText(res.getString("DSignCsr.jbAddExtensions.tooltip"));
    jbAddExtensions.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DSignCsr.this);
                addExtensionsPressed();
            } finally {
                CursorUtil.setCursorFree(DSignCsr.this);
            }
        }
    });
    jrbVersion3.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent evt) {
            jbAddExtensions.setEnabled(jrbVersion3.isSelected());
        }
    });
    jrbVersion3.setSelected(true);
    jbOK = new JButton(res.getString("DSignCsr.jbOK.text"));
    jbCancel = new JButton(res.getString("DSignCsr.jbCancel.text"));
    jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
    JPanel buttons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel);
    JPanel jpCsr = new JPanel();
    jpCsr.setBorder(new TitledBorder(new EtchedBorder(), res.getString("DSignCsr.jpCsrDetails.text")));
    JPanel jpSignOptions = new JPanel();
    jpSignOptions.setBorder(new TitledBorder(new EtchedBorder(), res.getString("DSignCsr.jpSigningOptions.text")));
    // layout
    getContentPane().setLayout(new MigLayout("fill", "", ""));
    getContentPane().add(jpCsr, "grow, wrap");
    getContentPane().add(jpSignOptions, "wrap unrel");
    getContentPane().add(buttons, "growx");
    jpCsr.setLayout(new MigLayout("fill", "[right]unrel[]", "[]unrel[]"));
    jpCsr.add(jlCsrFormat, "");
    jpCsr.add(jtfCsrFormat, "wrap");
    jpCsr.add(jlCsrSubject, "");
    jpCsr.add(jdnCsrSubject, "wrap");
    jpCsr.add(jlCsrPublicKey, "");
    jpCsr.add(jtfCsrPublicKey, "split 2");
    jpCsr.add(jbViewCsrPublicKeyDetails, "wrap");
    jpCsr.add(jlCsrSignatureAlgorithm, "");
    jpCsr.add(jtfCsrSignatureAlgorithm, "wrap");
    jpCsr.add(jlCsrChallenge, "");
    jpCsr.add(jtfCsrChallenge, "wrap");
    jpSignOptions.setLayout(new MigLayout("fill", "[right]unrel[]", "[]unrel[]"));
    jpSignOptions.add(jlVersion, "");
    jpSignOptions.add(jrbVersion1, "split 2");
    jpSignOptions.add(jrbVersion3, "wrap");
    jpSignOptions.add(jlSignatureAlgorithm, "");
    jpSignOptions.add(jcbSignatureAlgorithm, "wrap");
    jpSignOptions.add(jlValidityStart, "");
    jpSignOptions.add(jdtValidityStart, "wrap");
    jpSignOptions.add(jlValidityPeriod, "");
    jpSignOptions.add(jvpValidityPeriod, "wrap");
    jpSignOptions.add(jlValidityEnd, "");
    jpSignOptions.add(jdtValidityEnd, "wrap");
    jpSignOptions.add(jlSerialNumber, "");
    jpSignOptions.add(jtfSerialNumber, "wrap");
    jpSignOptions.add(jlCaReplyFile, "");
    jpSignOptions.add(jtfCaReplyFile, "split 2");
    jpSignOptions.add(jbBrowse, "wrap");
    jpSignOptions.add(jbAddExtensions, "spanx, wrap");
    jbViewCsrPublicKeyDetails.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DSignCsr.this);
                pubKeyDetailsPressed();
            } finally {
                CursorUtil.setCursorFree(DSignCsr.this);
            }
        }
    });
    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();
}
Also used : ImageIcon(javax.swing.ImageIcon) JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionEvent(java.awt.event.ActionEvent) MigLayout(net.miginfocom.swing.MigLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) JValidityPeriod(org.kse.gui.crypto.JValidityPeriod) SignatureType(org.kse.crypto.signing.SignatureType) JTextField(javax.swing.JTextField) TitledBorder(javax.swing.border.TitledBorder) Date(java.util.Date) EtchedBorder(javax.swing.border.EtchedBorder) JDistinguishedName(org.kse.gui.crypto.JDistinguishedName) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) WindowEvent(java.awt.event.WindowEvent) JDateTime(org.kse.gui.datetime.JDateTime) ChangeListener(javax.swing.event.ChangeListener) AbstractAction(javax.swing.AbstractAction)

Example 23 with EtchedBorder

use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.

the class DNewKeyStoreType method initComponents.

private void initComponents() {
    jlKeyStoreType = new JLabel(res.getString("DNewKeyStoreType.jlKeyStoreType.text"));
    jrbJceksKeyStore = new JRadioButton(res.getString("DNewKeyStoreType.jrbJceksKeyStore.text"), true);
    PlatformUtil.setMnemonic(jrbJceksKeyStore, res.getString("DNewKeyStoreType.jrbJceksKeyStore.mnemonic").charAt(0));
    jrbJceksKeyStore.setToolTipText(res.getString("DNewKeyStoreType.jrbJceksKeyStore.tooltip"));
    jrbJksKeyStore = new JRadioButton(res.getString("DNewKeyStoreType.jrbJksKeyStore.text"));
    PlatformUtil.setMnemonic(jrbJksKeyStore, res.getString("DNewKeyStoreType.jrbJksKeyStore.mnemonic").charAt(0));
    jrbJksKeyStore.setToolTipText(res.getString("DNewKeyStoreType.jrbJksKeyStore.tooltip"));
    jrbPkcs12KeyStore = new JRadioButton(res.getString("DNewKeyStoreType.jrbPkcs12KeyStore.text"));
    PlatformUtil.setMnemonic(jrbPkcs12KeyStore, res.getString("DNewKeyStoreType.jrbPkcs12KeyStore.mnemonic").charAt(0));
    jrbPkcs12KeyStore.setToolTipText(res.getString("DNewKeyStoreType.jrbPkcs12KeyStore.tooltip"));
    jrbBksV1KeyStore = new JRadioButton(res.getString("DNewKeyStoreType.jrbBksV1KeyStore.text"));
    PlatformUtil.setMnemonic(jrbBksV1KeyStore, res.getString("DNewKeyStoreType.jrbBksV1KeyStore.mnemonic").charAt(0));
    jrbBksV1KeyStore.setToolTipText(res.getString("DNewKeyStoreType.jrbBksV1KeyStore.tooltip"));
    jrbBksKeyStore = new JRadioButton(res.getString("DNewKeyStoreType.jrbBksKeyStore.text"));
    PlatformUtil.setMnemonic(jrbBksKeyStore, res.getString("DNewKeyStoreType.jrbBksKeyStore.mnemonic").charAt(0));
    jrbBksKeyStore.setToolTipText(res.getString("DNewKeyStoreType.jrbBksKeyStore.tooltip"));
    jrbUberKeyStore = new JRadioButton(res.getString("DNewKeyStoreType.jrbUberKeyStore.text"));
    PlatformUtil.setMnemonic(jrbUberKeyStore, res.getString("DNewKeyStoreType.jrbUberKeyStore.mnemonic").charAt(0));
    jrbUberKeyStore.setToolTipText(res.getString("DNewKeyStoreType.jrbUberKeyStore.tooltip"));
    ButtonGroup keyStoreTypes = new ButtonGroup();
    keyStoreTypes.add(jrbJceksKeyStore);
    keyStoreTypes.add(jrbJksKeyStore);
    keyStoreTypes.add(jrbPkcs12KeyStore);
    keyStoreTypes.add(jrbBksV1KeyStore);
    keyStoreTypes.add(jrbBksKeyStore);
    keyStoreTypes.add(jrbUberKeyStore);
    jpKeyStoreType = new JPanel(new GridLayout(7, 1));
    jpKeyStoreType.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));
    jpKeyStoreType.add(jlKeyStoreType);
    jpKeyStoreType.add(jrbJceksKeyStore);
    jpKeyStoreType.add(jrbJksKeyStore);
    jpKeyStoreType.add(jrbPkcs12KeyStore);
    jpKeyStoreType.add(jrbBksV1KeyStore);
    jpKeyStoreType.add(jrbBksKeyStore);
    jpKeyStoreType.add(jrbUberKeyStore);
    jbOK = new JButton(res.getString("DNewKeyStoreType.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel = new JButton(res.getString("DNewKeyStoreType.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(jpKeyStoreType, BorderLayout.CENTER);
    getContentPane().add(jpButtons, BorderLayout.SOUTH);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    setResizable(false);
    getRootPane().setDefaultButton(jbOK);
    pack();
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) GridLayout(java.awt.GridLayout) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction)

Example 24 with EtchedBorder

use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.

the class DViewCrl method initComponents.

private void initComponents() {
    GridBagConstraints gbcLbl = new GridBagConstraints();
    gbcLbl.gridx = 0;
    gbcLbl.gridwidth = 1;
    gbcLbl.gridheight = 1;
    gbcLbl.insets = new Insets(5, 5, 5, 5);
    gbcLbl.anchor = GridBagConstraints.EAST;
    GridBagConstraints gbcCtrl = new GridBagConstraints();
    gbcCtrl.gridx = 1;
    gbcCtrl.gridwidth = 1;
    gbcCtrl.gridheight = 1;
    gbcCtrl.insets = new Insets(5, 5, 5, 5);
    gbcCtrl.anchor = GridBagConstraints.WEST;
    jlVersion = new JLabel(res.getString("DViewCrl.jlVersion.text"));
    GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLbl.clone();
    gbc_jlVersion.gridy = 0;
    jtfVersion = new JTextField(3);
    jtfVersion.setEditable(false);
    jtfVersion.setToolTipText(res.getString("DViewCrl.jtfVersion.tooltip"));
    GridBagConstraints gbc_jtfVersion = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfVersion.gridy = 0;
    jlIssuer = new JLabel(res.getString("DViewCrl.jlIssuer.text"));
    GridBagConstraints gbc_jlIssuer = (GridBagConstraints) gbcLbl.clone();
    gbc_jlIssuer.gridy = 1;
    jdnIssuer = new JDistinguishedName(res.getString("DViewCrl.Issuer.Title"), 30, false);
    jdnIssuer.setToolTipText(res.getString("DViewCrl.jdnIssuer.tooltip"));
    GridBagConstraints gbc_jdnIssuer = (GridBagConstraints) gbcCtrl.clone();
    gbc_jdnIssuer.gridy = 1;
    jlEffectiveDate = new JLabel(res.getString("DViewCrl.jlEffectiveDate.text"));
    GridBagConstraints gbc_jlEffectiveDate = (GridBagConstraints) gbcLbl.clone();
    gbc_jlEffectiveDate.gridy = 2;
    jtfEffectiveDate = new JTextField(30);
    jtfEffectiveDate.setEditable(false);
    jtfEffectiveDate.setToolTipText(res.getString("DViewCrl.jtfEffectiveDate.tooltip"));
    GridBagConstraints gbc_jtfEffectiveDate = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfEffectiveDate.gridy = 2;
    jlNextUpdate = new JLabel(res.getString("DViewCrl.jlNextUpdate.text"));
    GridBagConstraints gbc_jlNextUpdate = (GridBagConstraints) gbcLbl.clone();
    gbc_jlNextUpdate.gridy = 3;
    jtfNextUpdate = new JTextField(30);
    jtfNextUpdate.setEditable(false);
    jtfNextUpdate.setToolTipText(res.getString("DViewCrl.jtfNextUpdate.tooltip"));
    GridBagConstraints gbc_jtfNextUpdate = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfNextUpdate.gridy = 3;
    jlSignatureAlgorithm = new JLabel(res.getString("DViewCrl.jlSignatureAlgorithm.text"));
    GridBagConstraints gbc_jlSignatureAlgorithm = (GridBagConstraints) gbcLbl.clone();
    gbc_jlSignatureAlgorithm.gridy = 4;
    jtfSignatureAlgorithm = new JTextField(15);
    jtfSignatureAlgorithm.setEditable(false);
    jtfSignatureAlgorithm.setToolTipText(res.getString("DViewCrl.jtfSignatureAlgorithm.tooltip"));
    GridBagConstraints gbc_jtfSignatureAlgorithm = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfSignatureAlgorithm.gridy = 4;
    jbCrlExtensions = new JButton(res.getString("DViewCrl.jbCrlExtensions.text"));
    PlatformUtil.setMnemonic(jbCrlExtensions, res.getString("DViewCrl.jbCrlExtensions.mnemonic").charAt(0));
    jbCrlExtensions.setToolTipText(res.getString("DViewCrl.jbCrlExtensions.tooltip"));
    jbCrlExtensions.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCrl.this);
                crlExtensionsPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCrl.this);
            }
        }
    });
    jbCrlAsn1 = new JButton(res.getString("DViewCrl.jbCrlAsn1.text"));
    PlatformUtil.setMnemonic(jbCrlAsn1, res.getString("DViewCrl.jbCrlAsn1.mnemonic").charAt(0));
    jbCrlAsn1.setToolTipText(res.getString("DViewCrl.jbCrlAsn1.tooltip"));
    jbCrlAsn1.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCrl.this);
                asn1DumpPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCrl.this);
            }
        }
    });
    jpCrlButtons = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
    jpCrlButtons.add(jbCrlExtensions);
    jpCrlButtons.add(jbCrlAsn1);
    GridBagConstraints gbc_jpCrlButtons = new GridBagConstraints();
    gbc_jpCrlButtons.gridx = 0;
    gbc_jpCrlButtons.gridy = 5;
    gbc_jpCrlButtons.gridwidth = 2;
    gbc_jpCrlButtons.gridheight = 1;
    gbc_jpCrlButtons.insets = new Insets(5, 0, 5, 0);
    gbc_jpCrlButtons.anchor = GridBagConstraints.EAST;
    jlRevokedCerts = new JLabel(res.getString("DViewCrl.jlRevokedCerts.text"));
    RevokedCertsTableModel rcModel = new RevokedCertsTableModel();
    jtRevokedCerts = new JKseTable(rcModel);
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(rcModel);
    jtRevokedCerts.setRowSorter(sorter);
    jtRevokedCerts.setShowGrid(false);
    jtRevokedCerts.setRowMargin(0);
    jtRevokedCerts.getColumnModel().setColumnMargin(0);
    jtRevokedCerts.getTableHeader().setReorderingAllowed(false);
    jtRevokedCerts.setAutoResizeMode(JKseTable.AUTO_RESIZE_ALL_COLUMNS);
    for (int i = 0; i < jtRevokedCerts.getColumnCount(); i++) {
        TableColumn column = jtRevokedCerts.getColumnModel().getColumn(i);
        if (i == 0) {
            column.setPreferredWidth(100);
        }
        column.setHeaderRenderer(new RevokedCertsTableHeadRend(jtRevokedCerts.getTableHeader().getDefaultRenderer()));
        column.setCellRenderer(new RevokedCertsTableCellRend());
    }
    ListSelectionModel listSelectionModel = jtRevokedCerts.getSelectionModel();
    listSelectionModel.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (// Ignore spurious
            !evt.getValueIsAdjusting()) // events
            {
                try {
                    CursorUtil.setCursorBusy(DViewCrl.this);
                    crlEntrySelection();
                } finally {
                    CursorUtil.setCursorFree(DViewCrl.this);
                }
            }
        }
    });
    jtRevokedCerts.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent evt) {
            maybeDisplayCrlEntryExtensions(evt);
        }
    });
    jspRevokedCertsTable = PlatformUtil.createScrollPane(jtRevokedCerts, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jspRevokedCertsTable.getViewport().setBackground(jtRevokedCerts.getBackground());
    jpRevokedCertsTable = new JPanel(new BorderLayout(10, 10));
    jpRevokedCertsTable.setPreferredSize(new Dimension(100, 200));
    jpRevokedCertsTable.add(jlRevokedCerts, BorderLayout.NORTH);
    jpRevokedCertsTable.add(jspRevokedCertsTable, BorderLayout.CENTER);
    jpRevokedCertsTable.setBorder(new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5)));
    jbCrlEntryExtensions = new JButton(res.getString("DViewCrl.jbCrlEntryExtensions.text"));
    PlatformUtil.setMnemonic(jbCrlEntryExtensions, res.getString("DViewCrl.jbCrlEntryExtensions.mnemonic").charAt(0));
    jbCrlEntryExtensions.setToolTipText(res.getString("DViewCrl.jbCrlEntryExtensions.tooltip"));
    jbCrlEntryExtensions.setEnabled(false);
    jbCrlEntryExtensions.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCrl.this);
                crlEntryExtensionsPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCrl.this);
            }
        }
    });
    jpCrlEntryExtensions = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    jpCrlEntryExtensions.add(jbCrlEntryExtensions);
    jpRevokedCertsTable.add(jpCrlEntryExtensions, BorderLayout.SOUTH);
    GridBagConstraints gbc_jpRevokedCertsTable = new GridBagConstraints();
    gbc_jpRevokedCertsTable.gridx = 0;
    gbc_jpRevokedCertsTable.gridy = 6;
    gbc_jpRevokedCertsTable.gridwidth = 2;
    gbc_jpRevokedCertsTable.gridheight = 1;
    gbc_jpRevokedCertsTable.insets = new Insets(5, 5, 5, 5);
    gbc_jpRevokedCertsTable.fill = GridBagConstraints.BOTH;
    gbc_jpRevokedCertsTable.anchor = GridBagConstraints.CENTER;
    jpCRL = new JPanel(new GridBagLayout());
    jpCRL.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10), new EtchedBorder()));
    jpCRL.add(jlVersion, gbc_jlVersion);
    jpCRL.add(jtfVersion, gbc_jtfVersion);
    jpCRL.add(jlIssuer, gbc_jlIssuer);
    jpCRL.add(jdnIssuer, gbc_jdnIssuer);
    jpCRL.add(jlEffectiveDate, gbc_jlEffectiveDate);
    jpCRL.add(jtfEffectiveDate, gbc_jtfEffectiveDate);
    jpCRL.add(jlNextUpdate, gbc_jlNextUpdate);
    jpCRL.add(jtfNextUpdate, gbc_jtfNextUpdate);
    jpCRL.add(jlSignatureAlgorithm, gbc_jlSignatureAlgorithm);
    jpCRL.add(jtfSignatureAlgorithm, gbc_jtfSignatureAlgorithm);
    jpCRL.add(jpCrlButtons, gbc_jpCrlButtons);
    jpCRL.add(jpRevokedCertsTable, gbc_jpRevokedCertsTable);
    populateDialog();
    jbOK = new JButton(res.getString("DViewCrl.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false);
    getContentPane().add(jpCRL, BorderLayout.CENTER);
    getContentPane().add(jpOK, BorderLayout.SOUTH);
    setResizable(false);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    getRootPane().setDefaultButton(jbOK);
    pack();
    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            jbOK.requestFocus();
        }
    });
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) ListSelectionEvent(javax.swing.event.ListSelectionEvent) WindowAdapter(java.awt.event.WindowAdapter) JTextField(javax.swing.JTextField) JDistinguishedName(org.kse.gui.crypto.JDistinguishedName) BorderLayout(java.awt.BorderLayout) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) TableRowSorter(javax.swing.table.TableRowSorter) MouseEvent(java.awt.event.MouseEvent) JKseTable(org.kse.gui.JKseTable) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) ListSelectionModel(javax.swing.ListSelectionModel) Dimension(java.awt.Dimension) TableColumn(javax.swing.table.TableColumn) Point(java.awt.Point) ListSelectionListener(javax.swing.event.ListSelectionListener) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) TableModel(javax.swing.table.TableModel)

Example 25 with EtchedBorder

use of javax.swing.border.EtchedBorder in project keystore-explorer by kaikramer.

the class DExportCertificates 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;
    jlExportLength = new JLabel(res.getString("DExportCertificates.jlExportLength.text"));
    GridBagConstraints gbc_jlExportLength = (GridBagConstraints) gbcLbl.clone();
    gbc_jlExportLength.gridy = 0;
    jrbExportHead = new JRadioButton(res.getString("DExportCertificates.jrbExportHead.text"));
    jrbExportHead.setToolTipText(res.getString("DExportCertificates.jrbExportHead.tooltip"));
    PlatformUtil.setMnemonic(jrbExportHead, res.getString("DExportCertificates.jrbExportHead.mnemonic").charAt(0));
    GridBagConstraints gbc_jrbExportHead = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbExportHead.gridy = 0;
    jrbExportChain = new JRadioButton(res.getString("DExportCertificates.jrbExportChain.text"));
    jrbExportChain.setToolTipText(res.getString("DExportCertificates.jrbExportChain.tooltip"));
    PlatformUtil.setMnemonic(jrbExportChain, res.getString("DExportCertificates.jrbExportChain.mnemonic").charAt(0));
    GridBagConstraints gbc_jrbExportChain = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbExportChain.gridy = 0;
    gbc_jrbExportChain.gridx = 6;
    ButtonGroup bgExportLength = new ButtonGroup();
    bgExportLength.add(jrbExportHead);
    bgExportLength.add(jrbExportChain);
    jrbExportHead.setSelected(true);
    jlExportFormat = new JLabel(res.getString("DExportCertificates.jlExportFormat.text"));
    GridBagConstraints gbc_jlExportFormat = (GridBagConstraints) gbcLbl.clone();
    gbc_jlExportFormat.gridy = 1;
    jrbExportX509 = new JRadioButton(res.getString("DExportCertificates.jrbExportX509.text"));
    jrbExportX509.setToolTipText(res.getString("DExportCertificates.jrbExportX509.tooltip"));
    PlatformUtil.setMnemonic(jrbExportX509, res.getString("DExportCertificates.jrbExportX509.mnemonic").charAt(0));
    GridBagConstraints gbc_jrbExportX509 = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbExportX509.gridy = 1;
    jrbExportPkcs7 = new JRadioButton(res.getString("DExportCertificates.jrbExportPkcs7.text"));
    jrbExportPkcs7.setToolTipText(res.getString("DExportCertificates.jrbExportPkcs7.tooltip"));
    PlatformUtil.setMnemonic(jrbExportPkcs7, res.getString("DExportCertificates.jrbExportPkcs7.mnemonic").charAt(0));
    GridBagConstraints gbc_jrbExportPkcs7 = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbExportPkcs7.gridy = 1;
    gbc_jrbExportPkcs7.gridx = 6;
    jrbExportPkiPath = new JRadioButton(res.getString("DExportCertificates.jrbExportPkiPath.text"));
    jrbExportPkiPath.setToolTipText(res.getString("DExportCertificates.jrbExportPkiPath.tooltip"));
    PlatformUtil.setMnemonic(jrbExportPkiPath, res.getString("DExportCertificates.jrbExportPkiPath.mnemonic").charAt(0));
    GridBagConstraints gbc_jrbExportPkiPath = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbExportPkiPath.gridy = 1;
    gbc_jrbExportPkiPath.gridx = 9;
    jrbExportSpc = new JRadioButton(res.getString("DExportCertificates.jrbExportSpc.text"));
    jrbExportSpc.setToolTipText(res.getString("DExportCertificates.jrbExportSpc.tooltip"));
    PlatformUtil.setMnemonic(jrbExportSpc, res.getString("DExportCertificates.jrbExportSpc.mnemonic").charAt(0));
    GridBagConstraints gbc_jrbExportSpc = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbExportSpc.gridy = 1;
    gbc_jrbExportSpc.gridx = 12;
    ButtonGroup bgExportFormat = new ButtonGroup();
    bgExportFormat.add(jrbExportX509);
    bgExportFormat.add(jrbExportPkcs7);
    bgExportFormat.add(jrbExportPkiPath);
    bgExportFormat.add(jrbExportSpc);
    jrbExportX509.setSelected(true);
    jlExportPem = new JLabel(res.getString("DExportCertificates.jlExportPem.text"));
    GridBagConstraints gbc_jlExportPem = (GridBagConstraints) gbcLbl.clone();
    gbc_jlExportPem.gridy = 2;
    jcbExportPem = new JCheckBox();
    jcbExportPem.setSelected(true);
    jcbExportPem.setToolTipText(res.getString("DExportCertificates.jcbExportPem.tooltip"));
    GridBagConstraints gbc_jcbExportPem = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jcbExportPem.gridy = 2;
    jlExportFile = new JLabel(res.getString("DExportCertificates.jlExportFile.text"));
    GridBagConstraints gbc_jlExportFile = (GridBagConstraints) gbcLbl.clone();
    gbc_jlExportFile.gridy = 3;
    jtfExportFile = new JTextField(30);
    jtfExportFile.setToolTipText(res.getString("DExportCertificates.jtfExportFile.tooltip"));
    GridBagConstraints gbc_jtfExportFile = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jtfExportFile.gridy = 3;
    gbc_jtfExportFile.gridwidth = 12;
    gbc_jtfExportFile.fill = GridBagConstraints.HORIZONTAL;
    jbBrowse = new JButton(res.getString("DExportCertificates.jbBrowse.text"));
    jbBrowse.setToolTipText(res.getString("DExportCertificates.jbBrowse.tooltip"));
    PlatformUtil.setMnemonic(jbBrowse, res.getString("DExportCertificates.jbBrowse.mnemonic").charAt(0));
    GridBagConstraints gbc_jbBrowse = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbBrowse.gridy = 3;
    gbc_jbBrowse.gridx = 15;
    jbBrowse.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DExportCertificates.this);
                browsePressed();
            } finally {
                CursorUtil.setCursorFree(DExportCertificates.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)));
    if (chain) {
        jpOptions.add(jlExportLength, gbc_jlExportLength);
        jpOptions.add(jrbExportHead, gbc_jrbExportHead);
        jpOptions.add(jrbExportChain, gbc_jrbExportChain);
    } else {
        gbc_jlExportFormat.gridy = gbc_jlExportFormat.gridy - 1;
        gbc_jrbExportX509.gridy = gbc_jrbExportX509.gridy - 1;
        gbc_jrbExportPkcs7.gridy = gbc_jrbExportPkcs7.gridy - 1;
        gbc_jrbExportPkiPath.gridy = gbc_jrbExportPkiPath.gridy - 1;
        gbc_jrbExportSpc.gridy = gbc_jrbExportSpc.gridy - 1;
        gbc_jlExportPem.gridy = gbc_jlExportPem.gridy - 1;
        gbc_jcbExportPem.gridy = gbc_jcbExportPem.gridy - 1;
        gbc_jlExportFile.gridy = gbc_jlExportFile.gridy - 1;
        gbc_jtfExportFile.gridy = gbc_jtfExportFile.gridy - 1;
        gbc_jbBrowse.gridy = gbc_jbBrowse.gridy - 1;
    }
    jpOptions.add(jlExportFormat, gbc_jlExportFormat);
    jpOptions.add(jrbExportX509, gbc_jrbExportX509);
    jpOptions.add(jrbExportPkcs7, gbc_jrbExportPkcs7);
    jpOptions.add(jrbExportPkiPath, gbc_jrbExportPkiPath);
    jpOptions.add(jrbExportSpc, gbc_jrbExportSpc);
    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);
    jrbExportChain.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            if (jrbExportChain.isSelected() && jrbExportX509.isSelected()) {
                jcbExportPem.setEnabled(false);
                jcbExportPem.setSelected(true);
            } else {
                jcbExportPem.setEnabled(true);
            }
        }
    });
    jrbExportX509.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            if (jrbExportX509.isSelected()) {
                updateFileExtension(FileChooserFactory.X509_EXT_1);
                if (jrbExportChain.isSelected()) {
                    jcbExportPem.setEnabled(false);
                    jcbExportPem.setSelected(true);
                } else {
                    jcbExportPem.setEnabled(true);
                }
            }
        }
    });
    jrbExportPkcs7.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            if (jrbExportPkcs7.isSelected()) {
                jcbExportPem.setEnabled(true);
                updateFileExtension(FileChooserFactory.PKCS7_EXT_1);
            }
        }
    });
    jrbExportSpc.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            if (jrbExportSpc.isSelected()) {
                jcbExportPem.setEnabled(false);
                jcbExportPem.setSelected(false);
                updateFileExtension(FileChooserFactory.SPC_EXT);
            } else {
                jcbExportPem.setEnabled(true);
            }
        }
    });
    jrbExportPkiPath.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            if (jrbExportPkiPath.isSelected()) {
                jcbExportPem.setEnabled(false);
                jcbExportPem.setSelected(false);
                updateFileExtension(FileChooserFactory.PKI_PATH_EXT);
            } else {
                jcbExportPem.setEnabled(true);
            }
        }
    });
    jbExport = new JButton(res.getString("DExportCertificates.jbExport.text"));
    PlatformUtil.setMnemonic(jbExport, res.getString("DExportCertificates.jbExport.mnemonic").charAt(0));
    jbExport.setToolTipText(res.getString("DExportCertificates.jbExport.tooltip"));
    jbExport.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DExportCertificates.this);
                exportPressed();
            } finally {
                CursorUtil.setCursorFree(DExportCertificates.this);
            }
        }
    });
    jbCancel = new JButton(res.getString("DExportCertificates.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();
        }
    });
    if (chain) {
        setTitle(MessageFormat.format(res.getString("DExportCertificates.CertificateChain.Title"), entryAlias));
    } else {
        setTitle(MessageFormat.format(res.getString("DExportCertificates.Certificate.Title"), entryAlias));
    }
    setResizable(false);
    getRootPane().setDefaultButton(jbExport);
    populateExportFileName();
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) ItemEvent(java.awt.event.ItemEvent) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) ItemListener(java.awt.event.ItemListener) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction)

Aggregations

EtchedBorder (javax.swing.border.EtchedBorder)116 JPanel (javax.swing.JPanel)92 JButton (javax.swing.JButton)74 JLabel (javax.swing.JLabel)74 ActionEvent (java.awt.event.ActionEvent)73 BorderLayout (java.awt.BorderLayout)72 ActionListener (java.awt.event.ActionListener)70 EmptyBorder (javax.swing.border.EmptyBorder)63 CompoundBorder (javax.swing.border.CompoundBorder)62 AbstractAction (javax.swing.AbstractAction)58 WindowAdapter (java.awt.event.WindowAdapter)55 WindowEvent (java.awt.event.WindowEvent)55 Insets (java.awt.Insets)46 GridBagConstraints (java.awt.GridBagConstraints)43 GridBagLayout (java.awt.GridBagLayout)43 JTextField (javax.swing.JTextField)40 Dimension (java.awt.Dimension)24 TitledBorder (javax.swing.border.TitledBorder)22 FlowLayout (java.awt.FlowLayout)18 JScrollPane (javax.swing.JScrollPane)17