Example usage for javax.swing BorderFactory createEtchedBorder

List of usage examples for javax.swing BorderFactory createEtchedBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createEtchedBorder.

Prototype

public static Border createEtchedBorder(int type) 

Source Link

Document

Creates a border with an "etched" look using the component's current background color for highlighting and shading.

Usage

From source file:org.zaproxy.zap.extension.tlsdebug.TlsDebugPanel.java

@SuppressWarnings("deprecation")
private void initialize() {

    this.setIcon(TLSDEBUG_ICON);
    this.setDefaultAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,
            // TODO Remove warn suppression and use View.getMenuShortcutKeyStroke with
            // newer ZAP (or use getMenuShortcutKeyMaskEx() with Java 10+)
            Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() | KeyEvent.ALT_DOWN_MASK, false));
    this.setLayout(new BorderLayout());

    JPanel panelContent = new JPanel(new GridBagLayout());
    this.add(panelContent, BorderLayout.NORTH);

    panelContent.setBackground(Color.white);
    panelContent.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    panelContent.add(new JLabel(Constant.messages.getString("tlsdebug.label.url")),
            LayoutHelper.getGBC(0, 0, 1, 0.0D, new Insets(5, 5, 5, 5)));

    JPanel urlSelectPanel = new JPanel(new GridBagLayout());
    JButton selectButton = new JButton(Constant.messages.getString("all.button.select"));
    selectButton.setIcon(//from  w ww.  j  a  v a  2  s.  c  o  m
            DisplayUtils.getScaledIcon(new ImageIcon(View.class.getResource("/resource/icon/16/094.png")))); // Globe
    // icon
    selectButton.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            NodeSelectDialog nsd = new NodeSelectDialog(View.getSingleton().getMainFrame());
            SiteNode node = null;
            try {
                node = Model.getSingleton().getSession().getSiteTree()
                        .findNode(new URI(getUrlField().getText(), false));
            } catch (Exception e2) {
                // Ignore
            }
            node = nsd.showDialog(node);
            if (node != null && node.getHistoryReference() != null) {
                try {
                    getUrlField().setText(node.getHistoryReference().getURI().toString());
                } catch (Exception e1) {
                    // Ignore
                }
            }
        }
    });

    urlSelectPanel.add(this.getUrlField(), LayoutHelper.getGBC(0, 0, 1, 1.0D));
    urlSelectPanel.add(selectButton, LayoutHelper.getGBC(1, 0, 1, 0.0D));
    panelContent.add(urlSelectPanel, LayoutHelper.getGBC(1, 0, 3, 0.25D));

    panelContent.add(this.getCheckButton(), LayoutHelper.getGBC(0, 1, 1, 0.0D));

    JPanel outputPanel = new JPanel(new BorderLayout());
    outputPanel.add(new JLabel(Constant.messages.getString("tlsdebug.label.console")), BorderLayout.NORTH);
    JScrollPane jScrollPane = new JScrollPane();
    jScrollPane.add(getOutputArea(), LayoutHelper.getGBC(0, 0, 4, 1.D, 1.0D)); // Padding
    // at
    // bottom
    jScrollPane.setFont(new java.awt.Font("Dialog", java.awt.Font.PLAIN, 11));
    jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    jScrollPane.setVerticalScrollBarPolicy(javax.swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    jScrollPane.setViewportView(getOutputArea());
    outputPanel.add(jScrollPane, BorderLayout.CENTER);

    this.add(outputPanel, BorderLayout.CENTER);
}

From source file:org.zaproxy.zap.view.TechnologyTreePanel.java

public TechnologyTreePanel(String nameRootNode) {
    setLayout(new BorderLayout());

    techToNodeMap = new HashMap<>();
    techTree = new JCheckBoxTree() {

        private static final long serialVersionUID = 1L;

        @Override//w  ww .j a v  a2  s .c o m
        protected void setExpandedState(TreePath path, boolean state) {
            // Ignore all collapse requests; collapse events will not be fired
            if (state) {
                super.setExpandedState(path, state);
            }
        }
    };
    // Initialise the structure based on all the tech we know about
    TechSet ts = new TechSet(Tech.builtInTech);
    Iterator<Tech> iter = ts.getIncludeTech().iterator();

    DefaultMutableTreeNode root = new DefaultMutableTreeNode(nameRootNode);
    Tech tech;
    DefaultMutableTreeNode parent;
    DefaultMutableTreeNode node;
    while (iter.hasNext()) {
        tech = iter.next();
        if (tech.getParent() != null) {
            parent = techToNodeMap.get(tech.getParent());
        } else {
            parent = null;
        }
        if (parent == null) {
            parent = root;
        }
        node = new DefaultMutableTreeNode(tech.getUiName());
        parent.add(node);
        techToNodeMap.put(tech, node);
    }

    techTree.setModel(new DefaultTreeModel(root));
    techTree.expandAll();
    techTree.setCheckBoxEnabled(new TreePath(root), false);
    reset();

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setViewportView(techTree);
    scrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

    add(scrollPane, BorderLayout.CENTER);
}

From source file:savant.plugin.ToolSettingsPanel.java

ToolSettingsPanel(Tool t) {
    tool = t;//from  w w w .  j a  v  a2  s .  co m
    setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridy = 0;
    try {
        tool.parseDescriptor();
        commandLine = new JLabel("", SwingConstants.CENTER);
        commandLine.setFont(new Font("Serif", Font.PLAIN, 14));
        commandLine.setBorder(
                BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                        BorderFactory.createEmptyBorder(5, 5, 5, 5)));
        gbc.insets = new Insets(10, 10, 10, 10);
        gbc.fill = GridBagConstraints.HORIZONTAL;
        add(commandLine, gbc);

        JButton executeButton = new JButton("Execute");
        executeButton.addActionListener(executeListener);
        gbc.insets = new Insets(5, 5, 5, 5);
        gbc.gridy = 1;
        gbc.fill = GridBagConstraints.NONE;
        add(executeButton, gbc);

        for (ToolArgument a : tool.arguments) {
            addArgumentToPanel(a, ++gbc.gridy);
        }
        gbc.gridx = 0;
        gbc.gridy++;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        add(new JPanel(), gbc);

        tool.displayCommandLine(commandLine);
    } catch (Exception x) {
        Tool.LOG.info(String.format("Unable to load %s.", tool.getDescriptor().getFile()), x);
        add(new JLabel(String.format("<html>Unable to load <i>%s</i><br>%s</html>",
                tool.getDescriptor().getFile(), x)), gbc);
    }
}