Search in sources :

Example 16 with EtchedBorder

use of javax.swing.border.EtchedBorder in project GenericKnimeNodes by genericworkflownodes.

the class ParameterDialog method createHelpPane.

private void createHelpPane() {
    helppanel = new JPanel();
    helppanel.setLayout(new BorderLayout());
    TitledBorder b = new TitledBorder(new EtchedBorder(), "Parameter description:");
    b.setTitleFont(MAND_FONT);
    helppanel.setBorder(b);
    helppanel.setPreferredSize(new Dimension(table.getWidth(), 50));
    help = new JTextPane();
    help.setEditable(false);
    helppanel.add(new JScrollPane(help));
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JTextPane(javax.swing.JTextPane) EtchedBorder(javax.swing.border.EtchedBorder) BorderLayout(java.awt.BorderLayout) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder)

Example 17 with EtchedBorder

use of javax.swing.border.EtchedBorder in project beast2 by CompEvol.

the class BEASTObjectInputEditor method expandedInit.

void expandedInit(Input<?> input, BEASTInterface beastObject) {
    addInputLabel();
    Box box = Box.createVerticalBox();
    // add horizontal box with combobox of BEASTObjects to select from
    Box combobox = Box.createHorizontalBox();
    addComboBox(combobox, input, beastObject);
    box.add(combobox);
    doc.getInputEditorFactory().addInputs(box, (BEASTInterface) input.get(), this, this, doc);
    box.setBorder(new EtchedBorder());
    // box.setBorder(BorderFactory.createLineBorder(Color.BLUE));
    add(box);
    m_expansionBox = box;
}
Also used : EtchedBorder(javax.swing.border.EtchedBorder) Box(javax.swing.Box) JComboBox(javax.swing.JComboBox)

Example 18 with EtchedBorder

use of javax.swing.border.EtchedBorder in project gate-core by GateNLP.

the class AnnotationStack method drawStack.

/**
 * Draw the annotation stack in a JPanel with a GridBagLayout.
 */
public void drawStack() {
    // clear the panel
    removeAll();
    boolean textTooLong = text.length() > maxTextLength;
    int upperBound = text.length() - (maxTextLength / 2);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    /**
     ********************
     * First row of text *
     ********************
     */
    gbc.gridwidth = 1;
    gbc.insets = new java.awt.Insets(10, 10, 10, 10);
    JLabel labelTitle = new JLabel("Context");
    labelTitle.setOpaque(true);
    labelTitle.setBackground(Color.WHITE);
    labelTitle.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(250, 250, 250), new Color(250, 250, 250).darker()), new EmptyBorder(new Insets(0, 2, 0, 2))));
    labelTitle.setToolTipText("Expression and its context.");
    add(labelTitle, gbc);
    gbc.insets = new java.awt.Insets(10, 0, 10, 0);
    int expressionStart = contextBeforeSize;
    int expressionEnd = text.length() - contextAfterSize;
    // for each character
    for (int charNum = 0; charNum < text.length(); charNum++) {
        gbc.gridx = charNum + 1;
        if (textTooLong) {
            if (charNum == maxTextLength / 2) {
                // add ellipsis dots in case of a too long text displayed
                add(new JLabel("..."), gbc);
                // skip the middle part of the text if too long
                charNum = upperBound + 1;
                continue;
            } else if (charNum > upperBound) {
                gbc.gridx -= upperBound - (maxTextLength / 2) + 1;
            }
        }
        // set the text and color of the feature value
        JLabel label = new JLabel(text.substring(charNum, charNum + 1));
        if (charNum >= expressionStart && charNum < expressionEnd) {
            // this part is matched by the pattern, color it
            label.setBackground(new Color(240, 201, 184));
        } else {
            // this part is the context, no color
            label.setBackground(Color.WHITE);
        }
        label.setOpaque(true);
        // get the word from which belongs the current character charNum
        int start = text.lastIndexOf(" ", charNum);
        int end = text.indexOf(" ", charNum);
        String word = text.substring((start == -1) ? 0 : start, (end == -1) ? text.length() : end);
        // add a mouse listener that modify the query
        label.addMouseListener(textMouseListener.createListener(word));
        add(label, gbc);
    }
    // for each row to display
    for (StackRow stackRow : stackRows) {
        String type = stackRow.getType();
        String feature = stackRow.getFeature();
        if (feature == null) {
            feature = "";
        }
        String shortcut = stackRow.getShortcut();
        if (shortcut == null) {
            shortcut = "";
        }
        gbc.gridy++;
        gbc.gridx = 0;
        gbc.gridwidth = 1;
        gbc.insets = new Insets(0, 0, 3, 0);
        // add the header of the row
        JLabel annotationTypeAndFeature = new JLabel();
        String typeAndFeature = type + (feature.equals("") ? "" : ".") + feature;
        annotationTypeAndFeature.setText(!shortcut.equals("") ? shortcut : stackRow.getSet() != null ? stackRow.getSet() + "#" + typeAndFeature : typeAndFeature);
        annotationTypeAndFeature.setOpaque(true);
        annotationTypeAndFeature.setBackground(Color.WHITE);
        annotationTypeAndFeature.setBorder(new CompoundBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(250, 250, 250), new Color(250, 250, 250).darker()), new EmptyBorder(new Insets(0, 2, 0, 2))));
        if (feature.equals("")) {
            annotationTypeAndFeature.addMouseListener(headerMouseListener.createListener(type));
        } else {
            annotationTypeAndFeature.addMouseListener(headerMouseListener.createListener(type, feature));
        }
        gbc.insets = new java.awt.Insets(0, 10, 3, 10);
        add(annotationTypeAndFeature, gbc);
        gbc.insets = new java.awt.Insets(0, 0, 3, 0);
        // add all annotations for this row
        HashMap<Integer, TreeSet<Integer>> gridSet = new HashMap<Integer, TreeSet<Integer>>();
        int gridyMax = gbc.gridy;
        for (StackAnnotation ann : stackRow.getAnnotations()) {
            gbc.gridx = ann.getStartNode().getOffset().intValue() - expressionStartOffset + contextBeforeSize + 1;
            gbc.gridwidth = ann.getEndNode().getOffset().intValue() - ann.getStartNode().getOffset().intValue();
            if (gbc.gridx == 0) {
                // column 0 is already the row header
                gbc.gridwidth -= 1;
                gbc.gridx = 1;
            } else if (gbc.gridx < 0) {
                // annotation starts before displayed text
                gbc.gridwidth += gbc.gridx - 1;
                gbc.gridx = 1;
            }
            if (gbc.gridx + gbc.gridwidth > text.length()) {
                // annotation ends after displayed text
                gbc.gridwidth = text.length() - gbc.gridx + 1;
            }
            if (textTooLong) {
                if (gbc.gridx > (upperBound + 1)) {
                    // x starts after the hidden middle part
                    gbc.gridx -= upperBound - (maxTextLength / 2) + 1;
                } else if (gbc.gridx > (maxTextLength / 2)) {
                    // x starts in the hidden middle part
                    if (gbc.gridx + gbc.gridwidth <= (upperBound + 3)) {
                        // skip the middle part of the text
                        continue;
                    } else {
                        // x ends after the hidden middle part
                        gbc.gridwidth -= upperBound - gbc.gridx + 2;
                        gbc.gridx = (maxTextLength / 2) + 2;
                    }
                } else {
                    // x starts before the hidden middle part
                    if (gbc.gridx + gbc.gridwidth < (maxTextLength / 2)) {
                    // x ends before the hidden middle part
                    // do nothing
                    } else if (gbc.gridx + gbc.gridwidth < upperBound) {
                        // x ends in the hidden middle part
                        gbc.gridwidth = (maxTextLength / 2) - gbc.gridx + 1;
                    } else {
                        // x ends after the hidden middle part
                        gbc.gridwidth -= upperBound - (maxTextLength / 2) + 1;
                    }
                }
            }
            if (gbc.gridwidth == 0) {
                gbc.gridwidth = 1;
            }
            JLabel label = new JLabel();
            Object object = ann.getFeatures().get(feature);
            String value = (object == null) ? " " : Strings.toString(object);
            if (value.length() > maxFeatureValueLength) {
                // show the full text in the tooltip
                label.setToolTipText((value.length() > 500) ? "<html><textarea rows=\"30\" cols=\"40\" readonly=\"readonly\">" + value.replaceAll("(.{50,60})\\b", "$1\n") + "</textarea></html>" : ((value.length() > 100) ? "<html><table width=\"500\" border=\"0\" cellspacing=\"0\">" + "<tr><td>" + value.replaceAll("\n", "<br>") + "</td></tr></table></html>" : value));
                if (stackRow.getCrop() == CROP_START) {
                    value = "..." + value.substring(value.length() - maxFeatureValueLength - 1);
                } else if (stackRow.getCrop() == CROP_END) {
                    value = value.substring(0, maxFeatureValueLength - 2) + "...";
                } else {
                    // cut in the middle
                    value = value.substring(0, maxFeatureValueLength / 2) + "..." + value.substring(value.length() - (maxFeatureValueLength / 2));
                }
            }
            label.setText(value);
            label.setBackground(AnnotationSetsView.getColor(stackRow.getSet(), ann.getType()));
            label.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
            label.setOpaque(true);
            label.addMouseListener(annotationMouseListener.createListener(stackRow.getSet(), type, String.valueOf(ann.getId())));
            // show the feature values in the tooltip
            if (!ann.getFeatures().isEmpty()) {
                String width = (Strings.toString(ann.getFeatures()).length() > 100) ? "500" : "100%";
                String toolTip = "<html><table width=\"" + width + "\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">";
                Color color = (Color) UIManager.get("ToolTip.background");
                float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
                color = Color.getHSBColor(hsb[0], hsb[1], // darken the color
                Math.max(0f, hsb[2] - hsb[2] * 0.075f));
                String hexColor = Integer.toHexString(color.getRed()) + Integer.toHexString(color.getGreen()) + Integer.toHexString(color.getBlue());
                // alternate background color every other row
                boolean odd = false;
                List<Object> features = new ArrayList<Object>(ann.getFeatures().keySet());
                // sort the features into alphabetical order
                Collections.sort(features, new Comparator<Object>() {

                    @Override
                    public int compare(Object o1, Object o2) {
                        return o1.toString().compareToIgnoreCase(o2.toString());
                    }
                });
                for (Object key : features) {
                    String fv = Strings.toString(ann.getFeatures().get(key));
                    toolTip += "<tr align=\"left\"" + (odd ? " bgcolor=\"#" + hexColor + "\"" : "") + "><td><strong>" + key + "</strong></td><td>" + ((fv.length() > 500) ? "<textarea rows=\"20\" cols=\"40\" cellspacing=\"0\">" + StringEscapeUtils.escapeHtml(fv.replaceAll("(.{50,60})\\b", "$1\n")) + "</textarea>" : StringEscapeUtils.escapeHtml(fv).replaceAll("\n", "<br>")) + "</td></tr>";
                    odd = !odd;
                }
                label.setToolTipText(toolTip + "</table></html>");
            } else {
                label.setToolTipText("No features.");
            }
            if (!feature.equals("")) {
                label.addMouseListener(annotationMouseListener.createListener(stackRow.getSet(), type, feature, Strings.toString(ann.getFeatures().get(feature)), String.valueOf(ann.getId())));
            }
            // find the first empty row span for this annotation
            int oldGridy = gbc.gridy;
            for (int y = oldGridy; y <= (gridyMax + 1); y++) {
                // for each cell of this row where spans the annotation
                boolean xSpanIsEmpty = true;
                for (int x = gbc.gridx; (x < (gbc.gridx + gbc.gridwidth)) && xSpanIsEmpty; x++) {
                    xSpanIsEmpty = !(gridSet.containsKey(x) && gridSet.get(x).contains(y));
                }
                if (xSpanIsEmpty) {
                    gbc.gridy = y;
                    break;
                }
            }
            // save the column x and row y of the current value
            TreeSet<Integer> ts;
            for (int x = gbc.gridx; x < (gbc.gridx + gbc.gridwidth); x++) {
                ts = gridSet.get(x);
                if (ts == null) {
                    ts = new TreeSet<Integer>();
                }
                ts.add(gbc.gridy);
                gridSet.put(x, ts);
            }
            add(label, gbc);
            gridyMax = Math.max(gridyMax, gbc.gridy);
            gbc.gridy = oldGridy;
        }
        // add a button at the end of the row
        gbc.gridwidth = 1;
        if (stackRow.getLastColumnButton() != null) {
            // last cell of the row
            gbc.gridx = Math.min(text.length(), maxTextLength) + 1;
            gbc.insets = new Insets(0, 10, 3, 0);
            gbc.fill = GridBagConstraints.NONE;
            gbc.anchor = GridBagConstraints.WEST;
            add(stackRow.getLastColumnButton(), gbc);
            gbc.insets = new Insets(0, 0, 3, 0);
            gbc.fill = GridBagConstraints.BOTH;
            gbc.anchor = GridBagConstraints.CENTER;
        }
        // set the new gridy to the maximum row we put a value
        gbc.gridy = gridyMax;
    }
    if (lastRowButton != null) {
        // add a configuration button on the last row
        gbc.insets = new java.awt.Insets(0, 10, 0, 10);
        gbc.gridx = 0;
        gbc.gridy++;
        add(lastRowButton, gbc);
    }
    // add an empty cell that takes all remaining space to
    // align the visible cells at the top-left corner
    gbc.gridy++;
    gbc.gridx = Math.min(text.length(), maxTextLength) + 1;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridheight = GridBagConstraints.REMAINDER;
    gbc.weightx = 1;
    gbc.weighty = 1;
    add(new JLabel(""), gbc);
    validate();
    updateUI();
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Insets(java.awt.Insets) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TreeSet(java.util.TreeSet) CompoundBorder(javax.swing.border.CompoundBorder) EmptyBorder(javax.swing.border.EmptyBorder) Color(java.awt.Color) JLabel(javax.swing.JLabel) EtchedBorder(javax.swing.border.EtchedBorder)

Example 19 with EtchedBorder

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

the class DExportPublicKeyOpenSsl 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;
    jlExportPem = new JLabel(res.getString("DExportPublicKeyOpenSsl.jlExportPem.text"));
    GridBagConstraints gbc_jlExportPem = (GridBagConstraints) gbcLbl.clone();
    gbc_jlExportPem.gridy = 4;
    jcbExportPem = new JCheckBox();
    jcbExportPem.setSelected(true);
    jcbExportPem.setToolTipText(res.getString("DExportPublicKeyOpenSsl.jcbExportPem.tooltip"));
    GridBagConstraints gbc_jcbExportPem = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jcbExportPem.gridy = 4;
    jlExportFile = new JLabel(res.getString("DExportPublicKeyOpenSsl.jlExportFile.text"));
    GridBagConstraints gbc_jlExportFile = (GridBagConstraints) gbcLbl.clone();
    gbc_jlExportFile.gridy = 5;
    jtfExportFile = new JTextField(30);
    jtfExportFile.setToolTipText(res.getString("DExportPublicKeyOpenSsl.jtfExportFile.tooltip"));
    GridBagConstraints gbc_jtfExportFile = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jtfExportFile.gridy = 5;
    gbc_jtfExportFile.gridwidth = 6;
    jbBrowse = new JButton(res.getString("DExportPublicKeyOpenSsl.jbBrowse.text"));
    jbBrowse.setToolTipText(res.getString("DExportPublicKeyOpenSsl.jbBrowse.tooltip"));
    PlatformUtil.setMnemonic(jbBrowse, res.getString("DExportPublicKeyOpenSsl.jbBrowse.mnemonic").charAt(0));
    GridBagConstraints gbc_jbBrowse = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbBrowse.gridy = 5;
    gbc_jbBrowse.gridx = 9;
    jbBrowse.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DExportPublicKeyOpenSsl.this);
                browsePressed();
            } finally {
                CursorUtil.setCursorFree(DExportPublicKeyOpenSsl.this);
            }
        }
    });
    jpOptions = new JPanel(new GridBagLayout());
    jpOptions.setBorder(new CompoundBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()), new EmptyBorder(5, 5, 5, 5)));
    jpOptions.add(jlExportPem, gbc_jlExportPem);
    jpOptions.add(jcbExportPem, gbc_jcbExportPem);
    jpOptions.add(jlExportFile, gbc_jlExportFile);
    jpOptions.add(jtfExportFile, gbc_jtfExportFile);
    jpOptions.add(jbBrowse, gbc_jbBrowse);
    jbExport = new JButton(res.getString("DExportPublicKeyOpenSsl.jbExport.text"));
    PlatformUtil.setMnemonic(jbExport, res.getString("DExportPublicKeyOpenSsl.jbExport.mnemonic").charAt(0));
    jbExport.setToolTipText(res.getString("DExportPublicKeyOpenSsl.jbExport.tooltip"));
    jbExport.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DExportPublicKeyOpenSsl.this);
                exportPressed();
            } finally {
                CursorUtil.setCursorFree(DExportPublicKeyOpenSsl.this);
            }
        }
    });
    jbCancel = new JButton(res.getString("DExportPublicKeyOpenSsl.jbCancel.text"));
    jbCancel.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });
    jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CANCEL_KEY);
    jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });
    jpButtons = PlatformUtil.createDialogButtonPanel(jbExport, jbCancel, false);
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(jpOptions, BorderLayout.CENTER);
    getContentPane().add(jpButtons, BorderLayout.SOUTH);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });
    setTitle(MessageFormat.format(res.getString("DExportPublicKeyOpenSsl.Title"), entryAlias));
    setResizable(false);
    getRootPane().setDefaultButton(jbExport);
    populateExportFileName();
    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) JTextField(javax.swing.JTextField) JCheckBox(javax.swing.JCheckBox) 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) AbstractAction(javax.swing.AbstractAction)

Example 20 with EtchedBorder

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

the class DImportKeyPairPkcs12 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;
    jlPassword = new JLabel(res.getString("DImportKeyPairPkcs12.jlPassword.text"));
    GridBagConstraints gbc_jlPassword = (GridBagConstraints) gbcLbl.clone();
    gbc_jlPassword.gridy = 0;
    jpfPassword = new JPasswordField(15);
    jpfPassword.setToolTipText(res.getString("DImportKeyPairPkcs12.jpfPassword.tooltip"));
    GridBagConstraints gbc_jpfPassword = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jpfPassword.gridy = 0;
    jlPkcs12Path = new JLabel(res.getString("DImportKeyPairPkcs12.jlPkcs12Path.text"));
    GridBagConstraints gbc_jlPkcs12 = (GridBagConstraints) gbcLbl.clone();
    gbc_jlPkcs12.gridy = 1;
    jtfPkcs12Path = new JTextField(30);
    jtfPkcs12Path.setToolTipText(res.getString("DImportKeyPairPkcs12.jtfPkcs12Path.tooltip"));
    GridBagConstraints gbc_jtfPkcs12Path = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jtfPkcs12Path.gridy = 1;
    gbc_jtfPkcs12Path.gridwidth = 6;
    jbBrowse = new JButton(res.getString("DImportKeyPairPkcs12.jbBrowse.text"));
    PlatformUtil.setMnemonic(jbBrowse, res.getString("DImportKeyPairPkcs12.jbBrowse.mnemonic").charAt(0));
    jbBrowse.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPkcs12.this);
                browsePressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPkcs12.this);
            }
        }
    });
    jbBrowse.setToolTipText(res.getString("DImportKeyPairPkcs12.jbBrowse.tooltip"));
    GridBagConstraints gbc_jbPkcs12Browse = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbPkcs12Browse.gridy = 1;
    gbc_jbPkcs12Browse.gridx = 9;
    jbDetails = new JButton(res.getString("DImportKeyPairPkcs12.jbDetails.text"));
    PlatformUtil.setMnemonic(jbDetails, res.getString("DImportKeyPairPkcs12.jbDetails.mnemonic").charAt(0));
    jbDetails.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPkcs12.this);
                detailsPressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPkcs12.this);
            }
        }
    });
    jbDetails.setToolTipText(res.getString("DImportKeyPairPkcs12.jbDetails.tooltip"));
    GridBagConstraints gbc_jbKeyPairDetails = (GridBagConstraints) gbcEdCtrl.clone();
    gbc_jbKeyPairDetails.gridy = 1;
    gbc_jbKeyPairDetails.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(jlPassword, gbc_jlPassword);
    jpKeyPair.add(jpfPassword, gbc_jpfPassword);
    jpKeyPair.add(jlPkcs12Path, gbc_jlPkcs12);
    jpKeyPair.add(jtfPkcs12Path, gbc_jtfPkcs12Path);
    jpKeyPair.add(jbBrowse, gbc_jbPkcs12Browse);
    jpKeyPair.add(jbDetails, gbc_jbKeyPairDetails);
    jbImport = new JButton(res.getString("DImportKeyPairPkcs12.jbImport.text"));
    PlatformUtil.setMnemonic(jbImport, res.getString("DImportKeyPairPkcs12.jbImport.mnemonic").charAt(0));
    jbImport.setToolTipText(res.getString("DImportKeyPairPkcs12.jbImport.tooltip"));
    jbImport.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DImportKeyPairPkcs12.this);
                importPressed();
            } finally {
                CursorUtil.setCursorFree(DImportKeyPairPkcs12.this);
            }
        }
    });
    jbCancel = new JButton(res.getString("DImportKeyPairPkcs12.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("DImportKeyPairPkcs12.Title"));
    setResizable(false);
    getRootPane().setDefaultButton(jbImport);
    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) JTextField(javax.swing.JTextField) 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) 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