Search in sources :

Example 86 with EtchedBorder

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

the class DViewKeyPair method initComponents.

private void initComponents() {
    jbPrivateKeyDetails = new JButton(res.getString("DViewKeyPair.jbPrivateKeyDetails.text"));
    PlatformUtil.setMnemonic(jbPrivateKeyDetails, res.getString("DViewKeyPair.jbPrivateKeyDetails.mnemonic").charAt(0));
    jbPrivateKeyDetails.setToolTipText(res.getString("DViewKeyPair.jbPrivateKeyDetails.tooltip"));
    jbPrivateKeyDetails.setEnabled(true);
    jbPrivateKeyDetails.addActionListener(new ActionListener() {

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

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewKeyPair.this);
                certificateDetailsPressed();
            } finally {
                CursorUtil.setCursorFree(DViewKeyPair.this);
            }
        }
    });
    jpKeyPairDetails = new JPanel(new FlowLayout(FlowLayout.LEFT));
    jpKeyPairDetails.setBorder(new CompoundBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()), new EmptyBorder(5, 5, 5, 5)));
    jpKeyPairDetails.add(jbPrivateKeyDetails);
    jpKeyPairDetails.add(jbCertificateDetails);
    jbOK = new JButton(res.getString("DViewCertificate.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(jpKeyPairDetails, 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) FlowLayout(java.awt.FlowLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) WindowAdapter(java.awt.event.WindowAdapter) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 87 with EtchedBorder

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

the class DViewSecretKey method initComponents.

private void initComponents() throws CryptoException {
    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 gbcTf = new GridBagConstraints();
    gbcTf.gridx = 1;
    gbcTf.gridwidth = 1;
    gbcTf.gridheight = 1;
    gbcTf.insets = new Insets(5, 5, 5, 5);
    gbcTf.anchor = GridBagConstraints.WEST;
    jlAlgorithm = new JLabel(res.getString("DViewSecretKey.jlAlgorithm.text"));
    GridBagConstraints gbc_jlAlgorithm = (GridBagConstraints) gbcLbl.clone();
    gbc_jlAlgorithm.gridy = 0;
    jtfAlgorithm = new JTextField(10);
    jtfAlgorithm.setEditable(false);
    jtfAlgorithm.setToolTipText(res.getString("DViewSecretKey.jtfAlgorithm.tooltip"));
    GridBagConstraints gbc_jtfAlgorithm = (GridBagConstraints) gbcTf.clone();
    gbc_jtfAlgorithm.gridy = 0;
    jlKeySize = new JLabel(res.getString("DViewSecretKey.jlKeySize.text"));
    GridBagConstraints gbc_jlKeySize = (GridBagConstraints) gbcLbl.clone();
    gbc_jlKeySize.gridy = 1;
    jtfKeySize = new JTextField(10);
    jtfKeySize.setEditable(false);
    jtfKeySize.setToolTipText(res.getString("DViewSecretKey.jtfKeySize.tooltip"));
    GridBagConstraints gbc_jtfKeySize = (GridBagConstraints) gbcTf.clone();
    gbc_jtfKeySize.gridy = 1;
    jlFormat = new JLabel(res.getString("DViewSecretKey.jlFormat.text"));
    GridBagConstraints gbc_jlFormat = (GridBagConstraints) gbcLbl.clone();
    gbc_jlFormat.gridy = 2;
    jtfFormat = new JTextField(10);
    jtfFormat.setEditable(false);
    jtfFormat.setToolTipText(res.getString("DViewSecretKey.jtfFormat.tooltip"));
    GridBagConstraints gbc_jtfFormat = (GridBagConstraints) gbcTf.clone();
    gbc_jtfFormat.gridy = 2;
    jlEncoded = new JLabel(res.getString("DViewSecretKey.jlEncoded.text"));
    GridBagConstraints gbc_jlEncoded = (GridBagConstraints) gbcLbl.clone();
    gbc_jlEncoded.gridy = 3;
    jtfEncoded = new JTextField(20);
    jtfEncoded.setEditable(false);
    jtfEncoded.setToolTipText(res.getString("DViewSecretKey.jtfEncoded.tooltip"));
    GridBagConstraints gbc_jtfEncoded = (GridBagConstraints) gbcTf.clone();
    gbc_jtfEncoded.gridy = 3;
    jpSecretKey = new JPanel(new GridBagLayout());
    jpSecretKey.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()));
    jpSecretKey.add(jlAlgorithm, gbc_jlAlgorithm);
    jpSecretKey.add(jtfAlgorithm, gbc_jtfAlgorithm);
    jpSecretKey.add(jlKeySize, gbc_jlKeySize);
    jpSecretKey.add(jtfKeySize, gbc_jtfKeySize);
    jpSecretKey.add(jlFormat, gbc_jlFormat);
    jpSecretKey.add(jtfFormat, gbc_jtfFormat);
    jpSecretKey.add(jlEncoded, gbc_jlEncoded);
    jpSecretKey.add(jtfEncoded, gbc_jtfEncoded);
    jbOK = new JButton(res.getString("DViewSecretKey.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, false);
    getContentPane().add(jpSecretKey, BorderLayout.CENTER);
    getContentPane().add(jpButtons, BorderLayout.SOUTH);
    setResizable(false);
    populateDialog();
    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) 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) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 88 with EtchedBorder

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

the class DPolicyInformationChooser method initComponents.

private void initComponents(PolicyInformation policyInformation) throws IOException {
    jlPolicyIdentifier = new JLabel(res.getString("DPolicyInformationChooser.jlPolicyIdentifier.text"));
    GridBagConstraints gbc_jlPolicyIdentifier = new GridBagConstraints();
    gbc_jlPolicyIdentifier.gridx = 0;
    gbc_jlPolicyIdentifier.gridy = 0;
    gbc_jlPolicyIdentifier.gridwidth = 1;
    gbc_jlPolicyIdentifier.gridheight = 1;
    gbc_jlPolicyIdentifier.insets = new Insets(5, 5, 5, 5);
    gbc_jlPolicyIdentifier.anchor = GridBagConstraints.EAST;
    joiPolicyIdentifier = new JObjectId(res.getString("DPolicyInformationChooser.PolicyIdentifier.Text"));
    joiPolicyIdentifier.setToolTipText(res.getString("DPolicyInformationChooser.joiPolicyIdentifier.tooltip"));
    GridBagConstraints gbc_joiPolicyIdentifier = new GridBagConstraints();
    gbc_joiPolicyIdentifier.gridx = 1;
    gbc_joiPolicyIdentifier.gridy = 0;
    gbc_joiPolicyIdentifier.gridwidth = 1;
    gbc_joiPolicyIdentifier.gridheight = 1;
    gbc_joiPolicyIdentifier.insets = new Insets(5, 5, 5, 5);
    gbc_joiPolicyIdentifier.anchor = GridBagConstraints.WEST;
    jlPolicyQualifiers = new JLabel(res.getString("DPolicyInformationChooser.jlPolicyQualifiers.text"));
    GridBagConstraints gbc_jlPolicyQualifiers = new GridBagConstraints();
    gbc_jlPolicyQualifiers.gridx = 0;
    gbc_jlPolicyQualifiers.gridy = 1;
    gbc_jlPolicyQualifiers.gridwidth = 1;
    gbc_jlPolicyQualifiers.gridheight = 1;
    gbc_jlPolicyQualifiers.insets = new Insets(5, 5, 5, 5);
    gbc_jlPolicyQualifiers.anchor = GridBagConstraints.NORTHEAST;
    jpqPolicyQualifiers = new JPolicyQualifierInfo(res.getString("DPolicyInformationChooser.PolicyQualifierInfo.Title"));
    jpqPolicyQualifiers.setPreferredSize(new Dimension(400, 150));
    GridBagConstraints gbc_jpqPolicyQualifiers = new GridBagConstraints();
    gbc_jpqPolicyQualifiers.gridx = 1;
    gbc_jpqPolicyQualifiers.gridy = 1;
    gbc_jpqPolicyQualifiers.gridwidth = 1;
    gbc_jpqPolicyQualifiers.gridheight = 1;
    gbc_jpqPolicyQualifiers.insets = new Insets(5, 5, 5, 5);
    gbc_jpqPolicyQualifiers.anchor = GridBagConstraints.WEST;
    jpPolicyInformation = new JPanel(new GridBagLayout());
    jpPolicyInformation.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));
    jpPolicyInformation.add(jlPolicyIdentifier, gbc_jlPolicyIdentifier);
    jpPolicyInformation.add(joiPolicyIdentifier, gbc_joiPolicyIdentifier);
    jpPolicyInformation.add(jlPolicyQualifiers, gbc_jlPolicyQualifiers);
    jpPolicyInformation.add(jpqPolicyQualifiers, gbc_jpqPolicyQualifiers);
    jbOK = new JButton(res.getString("DPolicyInformationChooser.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel = new JButton(res.getString("DPolicyInformationChooser.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(BorderLayout.CENTER, jpPolicyInformation);
    getContentPane().add(BorderLayout.SOUTH, jpButtons);
    populate(policyInformation);
    setResizable(false);
    getRootPane().setDefaultButton(jbOK);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JObjectId(org.kse.gui.oid.JObjectId) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction)

Example 89 with EtchedBorder

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

the class DPolicyQualifierInfoChooser method initComponents.

private void initComponents(PolicyQualifierInfo policyQualifierInfo) throws IOException {
    jlPolicyQualifierInfoType = new JLabel(res.getString("DPolicyQualifierInfoChooser.jlPolicyQualifierInfoType.text"));
    GridBagConstraints gbc_jlPolicyQualifierInfoType = new GridBagConstraints();
    gbc_jlPolicyQualifierInfoType.gridx = 0;
    gbc_jlPolicyQualifierInfoType.gridy = 0;
    gbc_jlPolicyQualifierInfoType.gridwidth = 1;
    gbc_jlPolicyQualifierInfoType.gridheight = 1;
    gbc_jlPolicyQualifierInfoType.anchor = GridBagConstraints.EAST;
    jrbCps = new JRadioButton(res.getString("DPolicyQualifierInfoChooser.jrbCps.text"));
    PlatformUtil.setMnemonic(jrbCps, res.getString("DPolicyQualifierInfoChooser.jrbCps.mnemonic").charAt(0));
    jrbCps.setToolTipText(res.getString("DPolicyQualifierInfoChooser.jrbCps.tooltip"));
    jrbCps.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            policyQualifierInfoTypeChanged();
        }
    });
    GridBagConstraints gbc_jrbCps = new GridBagConstraints();
    gbc_jrbCps.gridx = 1;
    gbc_jrbCps.gridy = 0;
    gbc_jrbCps.gridwidth = 1;
    gbc_jrbCps.gridheight = 1;
    gbc_jrbCps.anchor = GridBagConstraints.WEST;
    jrbUserNotice = new JRadioButton(res.getString("DPolicyQualifierInfoChooser.jrbUserNotice.text"));
    PlatformUtil.setMnemonic(jrbUserNotice, res.getString("DPolicyQualifierInfoChooser.jrbUserNotice.mnemonic").charAt(0));
    jrbUserNotice.setToolTipText(res.getString("DPolicyQualifierInfoChooser.jrbUserNotice.tooltip"));
    jrbUserNotice.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent evt) {
            policyQualifierInfoTypeChanged();
        }
    });
    GridBagConstraints gbc_jrbUserNotice = new GridBagConstraints();
    gbc_jrbUserNotice.gridx = 2;
    gbc_jrbUserNotice.gridy = 0;
    gbc_jrbUserNotice.gridwidth = 1;
    gbc_jrbUserNotice.gridheight = 1;
    gbc_jrbUserNotice.anchor = GridBagConstraints.WEST;
    ButtonGroup bgPolicyQualifierInfoType = new ButtonGroup();
    bgPolicyQualifierInfoType.add(jrbCps);
    bgPolicyQualifierInfoType.add(jrbUserNotice);
    jlPolicyQualifierInfoValue = new JLabel(res.getString("DPolicyQualifierInfoChooser.jlPolicyQualifierInfoValue.text"));
    GridBagConstraints gbc_jlPolicyQualifierInfoValue = new GridBagConstraints();
    gbc_jlPolicyQualifierInfoValue.gridx = 0;
    gbc_jlPolicyQualifierInfoValue.gridy = 1;
    gbc_jlPolicyQualifierInfoValue.gridwidth = 1;
    gbc_jlPolicyQualifierInfoValue.gridheight = 1;
    gbc_jlPolicyQualifierInfoValue.anchor = GridBagConstraints.EAST;
    jtfCps = new JTextField(30);
    junUserNotice = new JUserNotice(res.getString("DPolicyQualifierInfoChooser.UserNotice.Title"));
    jpPolicyQualifierInfoValue = new JPanel(new FlowLayout(FlowLayout.LEFT));
    GridBagConstraints gbc_jpPolicyQualifierInfoValue = new GridBagConstraints();
    gbc_jpPolicyQualifierInfoValue.gridx = 1;
    gbc_jpPolicyQualifierInfoValue.gridy = 1;
    gbc_jpPolicyQualifierInfoValue.gridwidth = 2;
    gbc_jpPolicyQualifierInfoValue.gridheight = 1;
    gbc_jpPolicyQualifierInfoValue.insets = new Insets(0, 0, 0, 0);
    gbc_jpPolicyQualifierInfoValue.anchor = GridBagConstraints.WEST;
    jpPolicyQualifierInfoValue.add(jtfCps);
    jpPolicyQualifierInfo = new JPanel(new GridBagLayout());
    jpPolicyQualifierInfo.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));
    jpPolicyQualifierInfo.add(jlPolicyQualifierInfoType, gbc_jlPolicyQualifierInfoType);
    jpPolicyQualifierInfo.add(jrbCps, gbc_jrbCps);
    jpPolicyQualifierInfo.add(jrbUserNotice, gbc_jrbUserNotice);
    jpPolicyQualifierInfo.add(jlPolicyQualifierInfoValue, gbc_jlPolicyQualifierInfoValue);
    jpPolicyQualifierInfo.add(jpPolicyQualifierInfoValue, gbc_jpPolicyQualifierInfoValue);
    jbOK = new JButton(res.getString("DPolicyQualifierInfoChooser.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel = new JButton(res.getString("DPolicyQualifierInfoChooser.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(BorderLayout.CENTER, jpPolicyQualifierInfo);
    getContentPane().add(BorderLayout.SOUTH, jpButtons);
    populate(policyQualifierInfo);
    setResizable(false);
    getRootPane().setDefaultButton(jbOK);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) ItemEvent(java.awt.event.ItemEvent) JRadioButton(javax.swing.JRadioButton) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) ItemListener(java.awt.event.ItemListener) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction)

Example 90 with EtchedBorder

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

the class DGenerateKeyPairCert method initComponents.

private void initComponents(String title) throws CryptoException {
    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;
    jlVersion = new JLabel(res.getString("DGenerateKeyPairCert.jlVersion.text"));
    GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLbl.clone();
    gbc_jlVersion.gridy = 0;
    jrbVersion1 = new JRadioButton(res.getString("DGenerateKeyPairCert.jrbVersion1.text"));
    jrbVersion1.setToolTipText(res.getString("DGenerateKeyPairCert.jrbVersion1.tooltip"));
    GridBagConstraints gbc_jrbVersion1 = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbVersion1.gridy = 0;
    gbc_jrbVersion1.gridwidth = 1;
    jrbVersion3 = new JRadioButton(res.getString("DGenerateKeyPairCert.jrbVersion3.text"));
    jrbVersion3.setToolTipText(res.getString("DGenerateKeyPairCert.jrbVersion3.tooltip"));
    GridBagConstraints gbc_jrbVersion3 = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jrbVersion3.gridx = 4;
    gbc_jrbVersion3.gridy = 0;
    gbc_jrbVersion3.gridwidth = 1;
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(jrbVersion1);
    buttonGroup.add(jrbVersion3);
    jlSigAlg = new JLabel(res.getString("DGenerateKeyPairCert.jlSigAlg.text"));
    GridBagConstraints gbc_jlSigAlg = (GridBagConstraints) gbcLbl.clone();
    gbc_jlSigAlg.gridy = 1;
    jcbSignatureAlgorithm = new JComboBox<SignatureType>();
    jcbSignatureAlgorithm.setToolTipText(res.getString("DGenerateKeyPairCert.jcbSignatureAlgorithm.tooltip"));
    jcbSignatureAlgorithm.setMaximumRowCount(10);
    GridBagConstraints gbc_jcbSigAlg = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jcbSigAlg.gridy = 1;
    // populate signature algorithm selector
    if (issuerPrivateKey != null) {
        KeyPairType issuerKeyPairType = KeyPairType.resolveJce(issuerPrivateKey.getAlgorithm());
        DialogHelper.populateSigAlgs(issuerKeyPairType, issuerPrivateKey, provider, jcbSignatureAlgorithm);
    } else {
        // self-signed
        DialogHelper.populateSigAlgs(keyPairType, keyPair.getPrivate(), provider, jcbSignatureAlgorithm);
    }
    Date now = new Date();
    jlValidityStart = new JLabel(res.getString("DGenerateKeyPairCert.jlValidityStart.text"));
    GridBagConstraints gbc_jlValidityStart = (GridBagConstraints) gbcLbl.clone();
    gbc_jlValidityStart.gridy = 2;
    jdtValidityStart = new JDateTime(res.getString("DGenerateKeyPairCert.jdtValidityStart.text"), false);
    jdtValidityStart.setDateTime(now);
    jdtValidityStart.setToolTipText(res.getString("DGenerateKeyPairCert.jdtValidityStart.tooltip"));
    GridBagConstraints gbc_jdtValidityStart = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jdtValidityStart.gridy = 2;
    jlValidityPeriod = new JLabel(res.getString("DGenerateKeyPairCert.jlValidityPeriod.text"));
    GridBagConstraints gbc_jlValidityPeriod = (GridBagConstraints) gbcLbl.clone();
    gbc_jlValidityPeriod.gridy = 3;
    jvpValidityPeriod = new JValidityPeriod(JValidityPeriod.YEARS);
    jvpValidityPeriod.setToolTipText(res.getString("DGenerateKeyPairCert.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);
        }
    });
    GridBagConstraints gbc_jvpValidityPeriod = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jvpValidityPeriod.gridy = 3;
    jlValidityEnd = new JLabel(res.getString("DGenerateKeyPairCert.jlValidityEnd.text"));
    GridBagConstraints gbc_jlValidityEnd = (GridBagConstraints) gbcLbl.clone();
    gbc_jlValidityEnd.gridy = 4;
    jdtValidityEnd = new JDateTime(res.getString("DGenerateKeyPairCert.jdtValidityEnd.text"), false);
    jdtValidityEnd.setDateTime(new Date(now.getTime() + TimeUnit.DAYS.toMillis(365)));
    jdtValidityEnd.setToolTipText(res.getString("DGenerateKeyPairCert.jdtValidityEnd.tooltip"));
    GridBagConstraints gbc_jdtValidityEnd = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jdtValidityEnd.gridy = 4;
    jlSerialNumber = new JLabel(res.getString("DGenerateKeyPairCert.jlSerialNumber.text"));
    GridBagConstraints gbc_jlSerialNumber = (GridBagConstraints) gbcLbl.clone();
    gbc_jlSerialNumber.gridy = 5;
    jtfSerialNumber = new JTextField("" + generateSerialNumber(), 20);
    jtfSerialNumber.setToolTipText(res.getString("DGenerateKeyPairCert.jtfSerialNumber.tooltip"));
    GridBagConstraints gbc_jtfSerialNumber = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jtfSerialNumber.gridy = 5;
    jlName = new JLabel(res.getString("DGenerateKeyPairCert.jlName.text"));
    GridBagConstraints gbc_jlName = (GridBagConstraints) gbcLbl.clone();
    gbc_jlName.gridy = 6;
    jdnName = new JDistinguishedName("Name", 30, true);
    jdnName.setToolTipText(res.getString("DGenerateKeyPairCert.jdnName.tooltip"));
    GridBagConstraints gbc_jdnName = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jdnName.gridy = 6;
    jbAddExtensions = new JButton(res.getString("DGenerateKeyPairCert.jbAddExtensions.text"));
    jbAddExtensions.setMnemonic(res.getString("DGenerateKeyPairCert.jbAddExtensions.mnemonic").charAt(0));
    jbAddExtensions.setToolTipText(res.getString("DGenerateKeyPairCert.jbAddExtensions.tooltip"));
    GridBagConstraints gbc_jbAddExtensions = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbAddExtensions.gridy = 7;
    gbc_jbAddExtensions.gridwidth = 8;
    gbc_jbAddExtensions.anchor = GridBagConstraints.EAST;
    jbAddExtensions.addActionListener(new ActionListener() {

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

        @Override
        public void stateChanged(ChangeEvent evt) {
            jbAddExtensions.setEnabled(jrbVersion3.isSelected());
        }
    });
    jrbVersion3.setSelected(true);
    jpOptions = new JPanel(new GridBagLayout());
    jpOptions.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()));
    jpOptions.add(jlVersion, gbc_jlVersion);
    jpOptions.add(jrbVersion1, gbc_jrbVersion1);
    jpOptions.add(jrbVersion3, gbc_jrbVersion3);
    jpOptions.add(jlSigAlg, gbc_jlSigAlg);
    jpOptions.add(jcbSignatureAlgorithm, gbc_jcbSigAlg);
    jpOptions.add(jlValidityStart, gbc_jlValidityStart);
    jpOptions.add(jdtValidityStart, gbc_jdtValidityStart);
    jpOptions.add(jlValidityPeriod, gbc_jlValidityPeriod);
    jpOptions.add(jvpValidityPeriod, gbc_jvpValidityPeriod);
    jpOptions.add(jlValidityEnd, gbc_jlValidityEnd);
    jpOptions.add(jdtValidityEnd, gbc_jdtValidityEnd);
    jpOptions.add(jlSerialNumber, gbc_jlSerialNumber);
    jpOptions.add(jtfSerialNumber, gbc_jtfSerialNumber);
    jpOptions.add(jlName, gbc_jlName);
    jpOptions.add(jdnName, gbc_jdnName);
    jpOptions.add(jbAddExtensions, gbc_jbAddExtensions);
    jbOK = new JButton(res.getString("DGenerateKeyPairCert.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel = new JButton(res.getString("DGenerateKeyPairCert.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();
        }
    });
    setTitle(title);
    setResizable(false);
    getRootPane().setDefaultButton(jbOK);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) JRadioButton(javax.swing.JRadioButton) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) WindowAdapter(java.awt.event.WindowAdapter) JValidityPeriod(org.kse.gui.crypto.JValidityPeriod) JTextField(javax.swing.JTextField) JDistinguishedName(org.kse.gui.crypto.JDistinguishedName) BorderLayout(java.awt.BorderLayout) ChangeListener(javax.swing.event.ChangeListener) CompoundBorder(javax.swing.border.CompoundBorder) KeyPairType(org.kse.crypto.keypair.KeyPairType) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction) JLabel(javax.swing.JLabel) SignatureType(org.kse.crypto.signing.SignatureType) Date(java.util.Date) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ButtonGroup(javax.swing.ButtonGroup) WindowEvent(java.awt.event.WindowEvent) JDateTime(org.kse.gui.datetime.JDateTime)

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