Search in sources :

Example 81 with EtchedBorder

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

the class DViewAsymmetricKeyFields method initFields.

private void initFields() {
    jlFields = new JLabel(res.getString("DViewAsymmetricKeyFields.jlFields.text"));
    jltFields = new JList<Field>();
    jltFields.setToolTipText(res.getString("DViewAsymmetricKeyFields.jltFields.tooltip"));
    jltFields.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jltFields.setBorder(new EtchedBorder());
    jltFields.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewAsymmetricKeyFields.this);
                updateFieldValue();
            } finally {
                CursorUtil.setCursorFree(DViewAsymmetricKeyFields.this);
            }
        }
    });
    jpFieldsList = new JPanel(new BorderLayout(5, 5));
    jpFieldsList.add(jlFields, BorderLayout.NORTH);
    jpFieldsList.add(jltFields, BorderLayout.CENTER);
    jpFieldValue = new JPanel(new BorderLayout(5, 5));
    jlFieldValue = new JLabel(res.getString("DViewAsymmetricKeyFields.jlFieldValue.text"));
    jpFieldValue.add(jlFieldValue, BorderLayout.NORTH);
    jtaFieldValue = new JTextArea();
    jtaFieldValue.setFont(new Font(Font.MONOSPACED, Font.PLAIN, LnfUtil.getDefaultFontSize()));
    jtaFieldValue.setEditable(false);
    jtaFieldValue.setToolTipText(res.getString("DViewAsymmetricKeyFields.jtaFieldValue.tooltip"));
    // JGoodies - keep uneditable color same as editable
    jtaFieldValue.putClientProperty("JTextArea.infoBackground", Boolean.TRUE);
    jspFieldValue = PlatformUtil.createScrollPane(jtaFieldValue, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jpFieldValueTextArea = new JPanel(new BorderLayout(10, 10));
    jpFieldValueTextArea.setPreferredSize(new Dimension(275, 200));
    jpFieldValueTextArea.add(jspFieldValue, BorderLayout.CENTER);
    jpFieldValue.add(jpFieldValueTextArea, BorderLayout.CENTER);
    jpFields = new JPanel(new BorderLayout(5, 5));
    jpFields.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));
    jpFields.add(jpFieldsList, BorderLayout.WEST);
    jpFields.add(jpFieldValue, BorderLayout.CENTER);
    jbOK = new JButton(res.getString("DViewAsymmetricKeyFields.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jpOK = PlatformUtil.createDialogButtonPanel(jbOK, false);
    populateFields();
    getContentPane().add(jpFields, 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) JTextArea(javax.swing.JTextArea) ActionEvent(java.awt.event.ActionEvent) ListSelectionEvent(javax.swing.event.ListSelectionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) Dimension(java.awt.Dimension) Font(java.awt.Font) ListSelectionListener(javax.swing.event.ListSelectionListener) EtchedBorder(javax.swing.border.EtchedBorder) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder)

Example 82 with EtchedBorder

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

the class DAddExtensionType method initComponents.

private void initComponents() {
    jpExtensionTypes = new JPanel(new BorderLayout(5, 5));
    jpExtensionTypes.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));
    jlExtensionTypes = new JLabel(res.getString("DAddExtensionType.jlExtensionTypes.text"));
    jltExtensionTypes = new JList<X509ExtensionType>();
    // Longest name to define constant width
    jltExtensionTypes.setPrototypeCellValue(NETSCAPE_CERTIFICATE_RENEWAL_URL);
    jltExtensionTypes.setToolTipText(res.getString("DAddExtensionType.jltExtensionTypes.tooltip"));
    jltExtensionTypes.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jltExtensionTypes.setBorder(new EtchedBorder());
    jltExtensionTypes.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent evt) {
            maybeAddExtension(evt);
        }
    });
    jspExtensionTypes = new JScrollPane(jltExtensionTypes);
    jcbCriticalExtension = new JCheckBox(res.getString("DAddExtensionType.jcbCriticalExtension.text"));
    jcbCriticalExtension.setMnemonic(res.getString("DAddExtensionType.jcbCriticalExtension.mnemonic").charAt(0));
    jcbCriticalExtension.setToolTipText(res.getString("DAddExtensionType.jcbCriticalExtension.tooltip"));
    jpExtensionTypes.add(jlExtensionTypes, BorderLayout.NORTH);
    jpExtensionTypes.add(jspExtensionTypes, BorderLayout.CENTER);
    jpExtensionTypes.add(jcbCriticalExtension, BorderLayout.SOUTH);
    jbOK = new JButton(res.getString("DAddExtensionType.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel = new JButton(res.getString("DAddExtensionType.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);
    populateExtensionTypes();
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(jpExtensionTypes, 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 : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) MouseEvent(java.awt.event.MouseEvent) ActionEvent(java.awt.event.ActionEvent) MouseAdapter(java.awt.event.MouseAdapter) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) WindowAdapter(java.awt.event.WindowAdapter) JCheckBox(javax.swing.JCheckBox) EtchedBorder(javax.swing.border.EtchedBorder) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) X509ExtensionType(org.kse.crypto.x509.X509ExtensionType) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction)

Example 83 with EtchedBorder

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

the class DAuthorityKeyIdentifier method initComponents.

private void initComponents() {
    jlKeyIdentifier = new JLabel(res.getString("DAuthorityKeyIdentifier.jlKeyIdentifer.text"));
    GridBagConstraints gbc_jlKeyIdentifier = new GridBagConstraints();
    gbc_jlKeyIdentifier.gridx = 0;
    gbc_jlKeyIdentifier.gridy = 0;
    gbc_jlKeyIdentifier.gridwidth = 1;
    gbc_jlKeyIdentifier.gridheight = 1;
    gbc_jlKeyIdentifier.insets = new Insets(5, 5, 5, 5);
    gbc_jlKeyIdentifier.anchor = GridBagConstraints.EAST;
    jkiKeyIdentifier = new JKeyIdentifier(res.getString("DAuthorityKeyIdentifier.KeyIdentifier.Title"), authorityPublicKey);
    GridBagConstraints gbc_jkiKeyIdentifier = new GridBagConstraints();
    gbc_jkiKeyIdentifier.gridx = 1;
    gbc_jkiKeyIdentifier.gridy = 0;
    gbc_jkiKeyIdentifier.gridwidth = 1;
    gbc_jkiKeyIdentifier.gridheight = 1;
    gbc_jkiKeyIdentifier.insets = new Insets(5, 5, 5, 5);
    gbc_jkiKeyIdentifier.anchor = GridBagConstraints.WEST;
    jlAuthorityCertIssuer = new JLabel(res.getString("DAuthorityKeyIdentifier.jlAuthorityCertIssuer.text"));
    GridBagConstraints gbc_jlAuthorityCertIssuer = new GridBagConstraints();
    gbc_jlAuthorityCertIssuer.gridx = 0;
    gbc_jlAuthorityCertIssuer.gridy = 1;
    gbc_jlAuthorityCertIssuer.gridwidth = 1;
    gbc_jlAuthorityCertIssuer.gridheight = 1;
    gbc_jlAuthorityCertIssuer.insets = new Insets(0, 5, 0, 5);
    gbc_jlAuthorityCertIssuer.anchor = GridBagConstraints.NORTHEAST;
    jgnAuthorityCertIssuer = new JGeneralNames(res.getString("DAuthorityKeyIdentifier.AuthorityCertIssuer.Title"));
    jgnAuthorityCertIssuer.setPreferredSize(new Dimension(400, 150));
    GridBagConstraints gbc_jgnAuthorityCertIssuer = new GridBagConstraints();
    gbc_jgnAuthorityCertIssuer.gridx = 1;
    gbc_jgnAuthorityCertIssuer.gridy = 1;
    gbc_jgnAuthorityCertIssuer.gridwidth = 1;
    gbc_jgnAuthorityCertIssuer.gridheight = 1;
    gbc_jgnAuthorityCertIssuer.insets = new Insets(0, 5, 0, 5);
    gbc_jgnAuthorityCertIssuer.anchor = GridBagConstraints.WEST;
    jlAuthorityCertSerialNumber = new JLabel(res.getString("DAuthorityKeyIdentifier.jlAuthorityCertSerialNumber.text"));
    GridBagConstraints gbc_jlAuthorityCertSerialNumber = new GridBagConstraints();
    gbc_jlAuthorityCertSerialNumber.gridx = 0;
    gbc_jlAuthorityCertSerialNumber.gridy = 2;
    gbc_jlAuthorityCertSerialNumber.gridwidth = 1;
    gbc_jlAuthorityCertSerialNumber.gridheight = 1;
    gbc_jlAuthorityCertSerialNumber.insets = new Insets(5, 5, 5, 5);
    gbc_jlAuthorityCertSerialNumber.anchor = GridBagConstraints.EAST;
    jtfAuthorityCertSerialNumber = new JTextField(20);
    GridBagConstraints gbc_jtfAuthorityCertSerialNumber = new GridBagConstraints();
    gbc_jtfAuthorityCertSerialNumber.gridx = 1;
    gbc_jtfAuthorityCertSerialNumber.gridy = 2;
    gbc_jtfAuthorityCertSerialNumber.gridwidth = 1;
    gbc_jtfAuthorityCertSerialNumber.gridheight = 1;
    gbc_jtfAuthorityCertSerialNumber.insets = new Insets(5, 5, 5, 5);
    gbc_jtfAuthorityCertSerialNumber.anchor = GridBagConstraints.WEST;
    jpAuthorityKeyIdentifier = new JPanel(new GridBagLayout());
    jpAuthorityKeyIdentifier.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()));
    jpAuthorityKeyIdentifier.add(jlKeyIdentifier, gbc_jlKeyIdentifier);
    jpAuthorityKeyIdentifier.add(jkiKeyIdentifier, gbc_jkiKeyIdentifier);
    jpAuthorityKeyIdentifier.add(jlAuthorityCertIssuer, gbc_jlAuthorityCertIssuer);
    jpAuthorityKeyIdentifier.add(jgnAuthorityCertIssuer, gbc_jgnAuthorityCertIssuer);
    jpAuthorityKeyIdentifier.add(jlAuthorityCertSerialNumber, gbc_jlAuthorityCertSerialNumber);
    jpAuthorityKeyIdentifier.add(jtfAuthorityCertSerialNumber, gbc_jtfAuthorityCertSerialNumber);
    jbOK = new JButton(res.getString("DAuthorityKeyIdentifier.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel = new JButton(res.getString("DAuthorityKeyIdentifier.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(jpAuthorityKeyIdentifier, 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) 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) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) EtchedBorder(javax.swing.border.EtchedBorder) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) JKeyIdentifier(org.kse.gui.crypto.JKeyIdentifier) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction) JGeneralNames(org.kse.gui.crypto.generalname.JGeneralNames)

Example 84 with EtchedBorder

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

the class DBasicConstraints method initComponents.

private void initComponents() {
    jlBasicConstraints = new JLabel(res.getString("DBasicConstraints.jlBasicConstraints.text"));
    jlBasicConstraints.setBorder(new EmptyBorder(5, 5, 0, 5));
    jcbSubjectIsCa = new JCheckBox(res.getString("DBasicConstraints.jcbSubjectIsCa.text"));
    jcbSubjectIsCa.setSelected(false);
    jcbSubjectIsCa.setBorder(new EmptyBorder(5, 5, 0, 5));
    jlPathLengthConstraint = new JLabel(res.getString("DBasicConstraints.jlPathLengthConstraint.text"));
    jtfPathLengthConstraint = new JTextField(3);
    jpPathLengthConstraint = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
    jpPathLengthConstraint.add(jlPathLengthConstraint);
    jpPathLengthConstraint.add(jtfPathLengthConstraint);
    jpBasicConstraints = new JPanel(new BorderLayout(5, 5));
    jpBasicConstraints.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new CompoundBorder(new EtchedBorder(), new EmptyBorder(5, 5, 5, 5))));
    jpBasicConstraints.add(jlBasicConstraints, BorderLayout.NORTH);
    jpBasicConstraints.add(jcbSubjectIsCa, BorderLayout.CENTER);
    jpBasicConstraints.add(jpPathLengthConstraint, BorderLayout.SOUTH);
    jbOK = new JButton(res.getString("DBasicConstraints.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });
    jbCancel = new JButton(res.getString("DBasicConstraints.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(jpBasicConstraints, 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) FlowLayout(java.awt.FlowLayout) 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) BorderLayout(java.awt.BorderLayout) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) AbstractAction(javax.swing.AbstractAction)

Example 85 with EtchedBorder

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

the class DViewCertificate method initComponents.

private void initComponents(X509Certificate[] certs) throws CryptoException {
    jlHierarchy = new JLabel(res.getString("DViewCertificate.jlHierarchy.text"));
    jtrHierarchy = new JTree(createCertificateNodes(certs));
    jtrHierarchy.setRowHeight(Math.max(18, jtrHierarchy.getRowHeight()));
    jtrHierarchy.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    ToolTipManager.sharedInstance().registerComponent(jtrHierarchy);
    jtrHierarchy.setCellRenderer(new CertificateTreeCellRend());
    jtrHierarchy.setRootVisible(false);
    TreeNode topNode = (TreeNode) jtrHierarchy.getModel().getRoot();
    expandTree(jtrHierarchy, new TreePath(topNode));
    jtrHierarchy.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCertificate.this);
                populateDetails();
            } finally {
                CursorUtil.setCursorFree(DViewCertificate.this);
            }
        }
    });
    jspHierarchy = PlatformUtil.createScrollPane(jtrHierarchy, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jspHierarchy.setPreferredSize(new Dimension(100, 75));
    jpHierarchy = new JPanel(new BorderLayout(5, 5));
    jpHierarchy.add(jlHierarchy, BorderLayout.NORTH);
    jpHierarchy.add(jspHierarchy, BorderLayout.CENTER);
    jpHierarchy.setBorder(new EmptyBorder(5, 5, 5, 5));
    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("DViewCertificate.jlVersion.text"));
    GridBagConstraints gbc_jlVersion = (GridBagConstraints) gbcLbl.clone();
    gbc_jlVersion.gridy = 0;
    jtfVersion = new JTextField(3);
    jtfVersion.setEditable(false);
    jtfVersion.setToolTipText(res.getString("DViewCertificate.jtfVersion.tooltip"));
    GridBagConstraints gbc_jtfVersion = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfVersion.gridy = 0;
    jlSubject = new JLabel(res.getString("DViewCertificate.jlSubject.text"));
    GridBagConstraints gbc_jlSubject = (GridBagConstraints) gbcLbl.clone();
    gbc_jlSubject.gridy = 1;
    jdnSubject = new JDistinguishedName(res.getString("DViewCertificate.Subject.Title"), 40, false);
    jdnSubject.setToolTipText(res.getString("DViewCertificate.jdnSubject.tooltip"));
    GridBagConstraints gbc_jdnSubject = (GridBagConstraints) gbcCtrl.clone();
    gbc_jdnSubject.gridy = 1;
    jlIssuer = new JLabel(res.getString("DViewCertificate.jlIssuer.text"));
    GridBagConstraints gbc_jlIssuer = (GridBagConstraints) gbcLbl.clone();
    gbc_jlIssuer.gridy = 2;
    jdnIssuer = new JDistinguishedName(res.getString("DViewCertificate.Issuer.Title"), 40, false);
    jdnIssuer.setToolTipText(res.getString("DViewCertificate.jdnIssuer.tooltip"));
    GridBagConstraints gbc_jdnIssuer = (GridBagConstraints) gbcCtrl.clone();
    gbc_jdnIssuer.gridy = 2;
    jlSerialNumber = new JLabel(res.getString("DViewCertificate.jlSerialNumber.text"));
    GridBagConstraints gbc_jlSerialNumber = (GridBagConstraints) gbcLbl.clone();
    gbc_jlSerialNumber.gridy = 3;
    jtfSerialNumber = new JTextField(30);
    jtfSerialNumber.setEditable(false);
    jtfSerialNumber.setToolTipText(res.getString("DViewCertificate.jtfSerialNumber.tooltip"));
    GridBagConstraints gbc_jtfSerialNumber = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfSerialNumber.gridy = 3;
    jlValidFrom = new JLabel(res.getString("DViewCertificate.jlValidFrom.text"));
    GridBagConstraints gbc_jlValidFrom = (GridBagConstraints) gbcLbl.clone();
    gbc_jlValidFrom.gridy = 4;
    jtfValidFrom = new JTextField(30);
    jtfValidFrom.setEditable(false);
    jtfValidFrom.setToolTipText(res.getString("DViewCertificate.jtfValidFrom.tooltip"));
    GridBagConstraints gbc_jtfValidFrom = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfValidFrom.gridy = 4;
    jlValidUntil = new JLabel(res.getString("DViewCertificate.jlValidUntil.text"));
    GridBagConstraints gbc_jlValidUntil = (GridBagConstraints) gbcLbl.clone();
    gbc_jlValidUntil.gridy = 5;
    jtfValidUntil = new JTextField(30);
    jtfValidUntil.setEditable(false);
    jtfValidUntil.setToolTipText(res.getString("DViewCertificate.jtfValidUntil.tooltip"));
    GridBagConstraints gbc_jtfValidUntil = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfValidUntil.gridy = 5;
    jlPublicKey = new JLabel(res.getString("DViewCertificate.jlPublicKey.text"));
    GridBagConstraints gbc_jlPublicKey = (GridBagConstraints) gbcLbl.clone();
    gbc_jlPublicKey.gridy = 6;
    jtfPublicKey = new JTextField(15);
    jtfPublicKey.setEditable(false);
    jtfPublicKey.setToolTipText(res.getString("DViewCertificate.jtfPublicKey.tooltip"));
    jbViewPublicKeyDetails = new JButton();
    jbViewPublicKeyDetails.setToolTipText(res.getString("DViewCertificate.jbViewPublicKeyDetails.tooltip"));
    jbViewPublicKeyDetails.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().createImage(getClass().getResource(res.getString("DViewCertificate.jbViewPublicKeyDetails.image")))));
    jbViewPublicKeyDetails.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCertificate.this);
                pubKeyDetailsPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCertificate.this);
            }
        }
    });
    jpPublicKey = new JPanel(new GridBagLayout());
    GridBagConstraints gbc_jpPublicKey = (GridBagConstraints) gbcCtrl.clone();
    gbc_jpPublicKey.gridy = 6;
    GridBagConstraints gbc_jtfPublicKey = new GridBagConstraints();
    gbc_jtfPublicKey.gridwidth = 1;
    gbc_jtfPublicKey.gridheight = 1;
    gbc_jtfPublicKey.gridx = 0;
    gbc_jtfPublicKey.gridy = 0;
    gbc_jtfPublicKey.insets = new Insets(0, 0, 0, 5);
    GridBagConstraints gbc_jbViewPublicKeyDetails = new GridBagConstraints();
    gbc_jbViewPublicKeyDetails.gridwidth = 1;
    gbc_jbViewPublicKeyDetails.gridheight = 1;
    gbc_jbViewPublicKeyDetails.gridx = 1;
    gbc_jbViewPublicKeyDetails.gridy = 0;
    gbc_jbViewPublicKeyDetails.insets = new Insets(0, 5, 0, 0);
    jpPublicKey.add(jtfPublicKey, gbc_jtfPublicKey);
    jpPublicKey.add(jbViewPublicKeyDetails, gbc_jbViewPublicKeyDetails);
    jlSignatureAlgorithm = new JLabel(res.getString("DViewCertificate.jlSignatureAlgorithm.text"));
    GridBagConstraints gbc_jlSignatureAlgorithm = (GridBagConstraints) gbcLbl.clone();
    gbc_jlSignatureAlgorithm.gridy = 7;
    jtfSignatureAlgorithm = new JTextField(15);
    jtfSignatureAlgorithm.setEditable(false);
    jtfSignatureAlgorithm.setToolTipText(res.getString("DViewCertificate.jtfSignatureAlgorithm.tooltip"));
    GridBagConstraints gbc_jtfSignatureAlgorithm = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfSignatureAlgorithm.gridy = 7;
    jlFingerprint = new JLabel(res.getString("DViewCertificate.jlFingerprint.text"));
    GridBagConstraints gbc_jlFingerprint = (GridBagConstraints) gbcLbl.clone();
    gbc_jlFingerprint.gridy = 8;
    jcfFingerprint = new JCertificateFingerprint(30);
    GridBagConstraints gbc_jcfFingerprint = (GridBagConstraints) gbcCtrl.clone();
    gbc_jcfFingerprint.gridy = 8;
    jbExtensions = new JButton(res.getString("DViewCertificate.jbExtensions.text"));
    PlatformUtil.setMnemonic(jbExtensions, res.getString("DViewCertificate.jbExtensions.mnemonic").charAt(0));
    jbExtensions.setToolTipText(res.getString("DViewCertificate.jbExtensions.tooltip"));
    jbExtensions.addActionListener(new ActionListener() {

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

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

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCertificate.this);
                asn1DumpPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCertificate.this);
            }
        }
    });
    if (importExport == IMPORT) {
        jbImportExport = new JButton(res.getString("DViewCertificate.jbImportExport.import.text"));
        jbImportExport.setToolTipText(res.getString("DViewCertificate.jbImportExport.import.tooltip"));
    } else {
        jbImportExport = new JButton(res.getString("DViewCertificate.jbImportExport.export.text"));
        jbImportExport.setToolTipText(res.getString("DViewCertificate.jbImportExport.export.tooltip"));
    }
    PlatformUtil.setMnemonic(jbImportExport, res.getString("DViewCertificate.jbImportExport.mnemonic").charAt(0));
    jbImportExport.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DViewCertificate.this);
                importExportPressed();
            } finally {
                CursorUtil.setCursorFree(DViewCertificate.this);
            }
        }
    });
    jpButtons = new JPanel();
    if (importExport != NONE) {
        jpButtons.add(jbImportExport);
    }
    jpButtons.add(jbExtensions);
    jpButtons.add(jbPem);
    jpButtons.add(jbAsn1);
    GridBagConstraints gbc_jpButtons = new GridBagConstraints();
    gbc_jpButtons.gridx = 0;
    gbc_jpButtons.gridy = 9;
    gbc_jpButtons.gridwidth = 2;
    gbc_jpButtons.gridheight = 1;
    gbc_jpButtons.anchor = GridBagConstraints.EAST;
    jpDetail = new JPanel(new GridBagLayout());
    jpDetail.setBorder(new EmptyBorder(5, 5, 5, 5));
    jpDetail.add(jlVersion, gbc_jlVersion);
    jpDetail.add(jtfVersion, gbc_jtfVersion);
    jpDetail.add(jlSubject, gbc_jlSubject);
    jpDetail.add(jdnSubject, gbc_jdnSubject);
    jpDetail.add(jlIssuer, gbc_jlIssuer);
    jpDetail.add(jdnIssuer, gbc_jdnIssuer);
    jpDetail.add(jlSerialNumber, gbc_jlSerialNumber);
    jpDetail.add(jtfSerialNumber, gbc_jtfSerialNumber);
    jpDetail.add(jlValidFrom, gbc_jlValidFrom);
    jpDetail.add(jtfValidFrom, gbc_jtfValidFrom);
    jpDetail.add(jlValidUntil, gbc_jlValidUntil);
    jpDetail.add(jtfValidUntil, gbc_jtfValidUntil);
    jpDetail.add(jlPublicKey, gbc_jlPublicKey);
    jpDetail.add(jpPublicKey, gbc_jpPublicKey);
    jpDetail.add(jlSignatureAlgorithm, gbc_jlSignatureAlgorithm);
    jpDetail.add(jtfSignatureAlgorithm, gbc_jtfSignatureAlgorithm);
    jpDetail.add(jlFingerprint, gbc_jlFingerprint);
    jpDetail.add(jcfFingerprint, gbc_jcfFingerprint);
    jpDetail.add(jpButtons, gbc_jpButtons);
    jpCertificates = new JPanel(new BorderLayout(0, 0));
    jpCertificates.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()));
    jpCertificates.add(jpHierarchy, BorderLayout.NORTH);
    jpCertificates.add(jpDetail, BorderLayout.CENTER);
    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().add(jpCertificates, BorderLayout.CENTER);
    getContentPane().add(jpOK, BorderLayout.SOUTH);
    jtrHierarchy.setSelectionRow(0);
    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) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) WindowAdapter(java.awt.event.WindowAdapter) TreeSelectionListener(javax.swing.event.TreeSelectionListener) JTextField(javax.swing.JTextField) JDistinguishedName(org.kse.gui.crypto.JDistinguishedName) BorderLayout(java.awt.BorderLayout) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreeNode(javax.swing.tree.TreeNode) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTree(javax.swing.JTree) EtchedBorder(javax.swing.border.EtchedBorder) TreePath(javax.swing.tree.TreePath) ActionListener(java.awt.event.ActionListener) WindowEvent(java.awt.event.WindowEvent) TreeSelectionEvent(javax.swing.event.TreeSelectionEvent) JCertificateFingerprint(org.kse.gui.crypto.JCertificateFingerprint)

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