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() 

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:it.imtech.metadata.MetaUtility.java

/**
 * Aggiunge il pannello delle classificazioni all'interfaccia dei metadati
 *
 * @param innerPanel Pannello sul quale aggiungere i metadati
 * @param kv Valori dei metadati//w ww  .  j av a 2  s  .com
 */
private void addClassification(JPanel innerPanel, Integer kv, final String sequence, final String panelname)
        throws Exception {
    try {
        ResourceBundle bundle = ResourceBundle.getBundle(Globals.RESOURCES, Globals.CURRENT_LOCALE,
                Globals.loader);

        DefaultMutableTreeNode hierarchy = new DefaultMutableTreeNode("root");
        selected = null;
        String selectedPath = "";

        String link = selectedClassificationList.get(panelname + "---" + sequence);

        recursiveOefosTreeviewBuild(hierarchy, oefos.get(link), sequence, panelname);
        DefaultTreeModel model = new DefaultTreeModel(hierarchy);

        final JTree tree = new JTree(model);
        tree.setRootVisible(false);

        if (selected != null) {
            TreePath selpath = new TreePath(selected.getPath());
            tree.setSelectionPath(selpath);

            Object[] nodes = selpath.getPath();

            for (int i = 1; i < nodes.length; i++) {
                selectedPath += nodes[i].toString();
                selectedPath += (i != nodes.length - 1) ? "/" : "";
            }
        }

        tree.setName("MID_" + Integer.toString(kv) + "---" + sequence);
        tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

        tree.addTreeSelectionListener(new TreeSelectionListener() {

            public void valueChanged(TreeSelectionEvent e) {
                try {
                    setOEFOS(tree, sequence, panelname);
                } catch (Exception ex) {
                    logger.error(ex.getMessage());
                }
            }
        });

        javax.swing.JScrollPane tree_scroller = new javax.swing.JScrollPane();
        tree_scroller
                .setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        tree_scroller.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        tree_scroller.setViewportView(tree);
        tree_scroller.setBorder(null);

        innerPanel.add(tree_scroller, "wrap, width 100:800:800");

        JPanel iPanel = new JPanel(new MigLayout());
        iPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
                Utility.getBundleString("choose2", bundle), TitledBorder.LEFT, TitledBorder.TOP));
        JLabel label = new JLabel();
        label.setName("classification_path" + "---" + sequence);
        label.setText(selectedPath);
        iPanel.add(label, "wrap, growx, height 30:30:30");

        innerPanel.add(iPanel, "wrap, width 100:800:800");

        findLastClassification(panelname);

    } catch (Exception ex) {
        logger.error(ex.getMessage());
        throw new Exception("Exception in addClassification: " + ex.getStackTrace() + "\n");
    }
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Sets a border on the component as defined in the properties.
 * @param comp the component/*from www.j a va2  s .co m*/
 * @param props the list of properties
 */
protected void setBorder(final JComponent comp, final Properties props) {
    if (props != null) {
        String borderType = props.getProperty("border");
        if (StringUtils.isNotEmpty(borderType)) {
            if (borderType.equals("etched")) {
                comp.setBorder(BorderFactory.createEtchedBorder());

            } else if (borderType.equals("lowered")) {
                comp.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

            } else if (borderType.equals("raised")) {
                comp.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));

            } else if (borderType.equals("empty")) {
                comp.setBorder(BorderFactory.createEmptyBorder());

            } else if (borderType.equals("line")) {
                Color color = Color.LIGHT_GRAY;
                String borderColor = props.getProperty("bordercolor");
                if (StringUtils.isNotEmpty(borderColor)) {
                    try {
                        color = UIHelper.parseRGB(borderColor);

                    } catch (ConfigurationException ex) {
                        log.error(ex);
                    }
                }
                comp.setBorder(BorderFactory.createLineBorder(color));
            }
        }
    }
}

From source file:nz.ac.massey.cs.gql4jung.browser.ResultBrowser.java

private void initStatusBar() {
    this.cursorField = new JLabel();
    this.queryField = new JLabel();
    this.dataField = new JLabel();
    this.statusField = new JProgressBar();
    statusField.setStringPainted(true);/*from  ww w  .  j ava 2s. c o  m*/
    statusField.setBorderPainted(true);

    this.timeField = new JLabel();
    Font font = new Font("monospaced", Font.PLAIN, this.cursorField.getFont().getSize());
    this.cursorField.setFont(font);
    this.dataField.setFont(font);
    this.queryField.setFont(font);
    this.timeField.setFont(font);
    this.statusField.setFont(font);

    JPanel statusBar = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    int cols = 6;
    c.insets = new Insets(0, 3, 0, 3);
    c.gridx = 0;
    c.gridy = 0;
    c.fill = c.NONE;
    c.weightx = 0;
    c.anchor = c.EAST;
    c.gridwidth = 1;
    statusBar.add(new JLabel("data:", JLabel.RIGHT), c);
    c.gridx = 1;
    c.fill = c.HORIZONTAL;
    c.weightx = 1;
    c.anchor = c.WEST;
    c.gridwidth = cols - 1;
    statusBar.add(dataField, c);
    c.gridx = 0;
    c.gridy = 1;
    c.fill = c.NONE;
    c.weightx = 0;
    c.anchor = c.EAST;
    c.gridwidth = 1;
    statusBar.add(new JLabel("query:", JLabel.RIGHT), c);
    c.gridx = 1;
    c.fill = c.HORIZONTAL;
    c.weightx = 1;
    c.anchor = c.WEST;
    c.gridwidth = cols - 1;
    statusBar.add(queryField, c);

    c.gridx = 0;
    c.gridy = 2;
    c.fill = c.NONE;
    c.weightx = 0;
    c.anchor = c.EAST;
    c.gridwidth = 1;
    statusBar.add(new JLabel("status:", JLabel.RIGHT), c);
    c.gridx = 1;
    c.fill = c.HORIZONTAL;
    c.weightx = 1;
    c.anchor = c.WEST;
    statusBar.add(statusField, c);

    c.gridx = 2;
    c.gridy = 2;
    c.fill = c.NONE;
    c.weightx = 0;
    c.anchor = c.EAST;
    c.gridwidth = 1;
    statusBar.add(new JLabel("cursor:", JLabel.RIGHT), c);
    c.gridx = 3;
    c.fill = c.HORIZONTAL;
    c.weightx = 1;
    c.anchor = c.WEST;
    statusBar.add(cursorField, c);

    c.gridx = 4;
    c.gridy = 2;
    c.fill = c.NONE;
    c.weightx = 0;
    c.anchor = c.EAST;
    c.gridwidth = 1;
    statusBar.add(new JLabel("computation time:", JLabel.RIGHT), c);
    c.gridx = 5;
    c.fill = c.HORIZONTAL;
    c.weightx = 1;
    c.anchor = c.WEST;
    statusBar.add(timeField, c);

    mainPanel.add(statusBar, BorderLayout.SOUTH);
    statusBar.setBorder(BorderFactory.createEtchedBorder());
}

From source file:org.apache.cayenne.modeler.editor.EditorView.java

private void initView() {

    // init widgets
    JButton collapseButton = getAction(CollapseTreeAction.class).buildButton();
    collapseButton.setPreferredSize(new Dimension(30, 20));
    JButton filterButton = getAction(FilterAction.class).buildButton();
    filterButton.setPreferredSize(new Dimension(30, 20));
    actionManager.getAction(CollapseTreeAction.class).setAlwaysOn(true);
    actionManager.getAction(FilterAction.class).setAlwaysOn(true);

    JToolBar barPanel = new JToolBar();
    barPanel.setMinimumSize(new Dimension(75, 25));
    barPanel.setBorder(BorderFactory.createEtchedBorder());
    barPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    barPanel.add(Box.createHorizontalStrut(3));
    barPanel.add(filterButton);//from   ww  w .  ja  v a 2 s .  c o  m
    barPanel.addSeparator();
    barPanel.add(collapseButton);

    treePanel = new ProjectTreeView(eventController);
    treePanel.setMinimumSize(new Dimension(75, 180));
    JPanel treeNavigatePanel = new JPanel();
    treeNavigatePanel.setMinimumSize(new Dimension(75, 220));
    treeNavigatePanel.setLayout(new BorderLayout());
    treeNavigatePanel.add(treePanel, BorderLayout.CENTER);

    this.detailPanel = new JPanel();
    this.splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    this.leftPanel = new JPanel(new BorderLayout());
    // assemble...

    this.detailLayout = new CardLayout();
    detailPanel.setLayout(detailLayout);

    // some but not all panels must be wrapped in a scroll pane
    // those that are not wrapped usually have there own scrollers
    // in subpanels...

    detailPanel.add(new JPanel(), EMPTY_VIEW);

    dataDomainView = new DataDomainTabbedView(eventController);
    detailPanel.add(dataDomainView, DOMAIN_VIEW);

    DataNodeEditor nodeController = new DataNodeEditor(eventController);
    detailPanel.add(nodeController.getView(), NODE_VIEW);

    dataNodeView = nodeController.getTabComponent();

    dataMapView = new DataMapTabbedView(eventController);
    detailPanel.add(dataMapView, DATA_MAP_VIEW);

    procedureView = new ProcedureTabbedView(eventController);
    detailPanel.add(procedureView, PROCEDURE_VIEW);

    selectQueryView = new SelectQueryTabbedView(eventController);
    detailPanel.add(selectQueryView, SELECT_QUERY_VIEW);

    sqlTemplateView = new SQLTemplateTabbedView(eventController);
    detailPanel.add(sqlTemplateView, SQL_TEMPLATE_VIEW);

    Component procedureQueryView = new ProcedureQueryView(eventController);
    detailPanel.add(new JScrollPane(procedureQueryView), PROCEDURE_QUERY_VIEW);

    ejbqlQueryView = new EjbqlTabbedView(eventController);
    detailPanel.add(ejbqlQueryView, EJBQL_QUERY_VIEW);

    embeddableView = new EmbeddableTabbedView(eventController);
    detailPanel.add(embeddableView, EMBEDDABLE_VIEW);

    objDetailView = new ObjEntityTabbedView(eventController);
    detailPanel.add(objDetailView, OBJ_VIEW);

    dbDetailView = new DbEntityTabbedView(eventController);
    detailPanel.add(dbDetailView, DB_VIEW);

    leftPanel.add(barPanel, BorderLayout.NORTH);
    leftPanel.add(new JScrollPane(treeNavigatePanel), BorderLayout.CENTER);
    splitPane.setLeftComponent(leftPanel);
    splitPane.setRightComponent(detailPanel);

    setLayout(new BorderLayout());
    add(splitPane, BorderLayout.CENTER);

}

From source file:org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui.java

protected JPanel createEmbeddedRsrcPanel() {
    // retrieve Embedded resources
    retrieveEmbeddedResources = new JCheckBox(JMeterUtils.getResString("web_testing_retrieve_images")); // $NON-NLS-1$
    // add a listener to activate or not concurrent dwn.
    retrieveEmbeddedResources.addItemListener(new ItemListener() {
        @Override/*  ww w. j ava2  s.co m*/
        public void itemStateChanged(final ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                enableConcurrentDwn(true);
            } else {
                enableConcurrentDwn(false);
            }
        }
    });
    // Download concurrent resources
    concurrentDwn = new JCheckBox(JMeterUtils.getResString("web_testing_concurrent_download")); // $NON-NLS-1$
    concurrentDwn.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (retrieveEmbeddedResources.isSelected() && e.getStateChange() == ItemEvent.SELECTED) {
                concurrentPool.setEnabled(true);
            } else {
                concurrentPool.setEnabled(false);
            }
        }
    });
    concurrentPool = new JTextField(2); // 2 columns size
    concurrentPool.setMinimumSize(new Dimension(10, (int) concurrentPool.getPreferredSize().getHeight()));
    concurrentPool.setMaximumSize(new Dimension(30, (int) concurrentPool.getPreferredSize().getHeight()));

    final JPanel embeddedRsrcPanel = new HorizontalPanel();
    embeddedRsrcPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("web_testing_retrieve_title"))); // $NON-NLS-1$
    embeddedRsrcPanel.add(retrieveEmbeddedResources);
    embeddedRsrcPanel.add(concurrentDwn);
    embeddedRsrcPanel.add(concurrentPool);

    // Embedded URL match regex
    embeddedRE = new JLabeledTextField(JMeterUtils.getResString("web_testing_embedded_url_pattern"), 20); // $NON-NLS-1$
    embeddedRsrcPanel.add(embeddedRE);

    return embeddedRsrcPanel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui.java

protected JPanel createSourceAddrPanel() {
    final JPanel sourceAddrPanel = new HorizontalPanel();
    sourceAddrPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("web_testing_source_ip"))); // $NON-NLS-1$

    sourceIpType.setSelectedIndex(HTTPSamplerBase.SourceType.HOSTNAME.ordinal()); //default: IP/Hostname
    sourceAddrPanel.add(sourceIpType);//from ww  w.  j  a v a2  s  .com

    sourceIpAddr = new JTextField();
    sourceAddrPanel.add(sourceIpAddr);
    return sourceAddrPanel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui.java

protected JPanel createOptionalTasksPanel() {
    // OPTIONAL TASKS
    final JPanel checkBoxPanel = new VerticalPanel();
    checkBoxPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("optional_tasks"))); // $NON-NLS-1$

    // Use MD5/*from www .  jav a  2s  . c  o m*/
    useMD5 = new JCheckBox(JMeterUtils.getResString("response_save_as_md5")); // $NON-NLS-1$

    checkBoxPanel.add(useMD5);

    return checkBoxPanel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java

private void init() {// called from ctor, so must not be overridable
    this.setLayout(new BorderLayout());

    // WEB REQUEST PANEL
    JPanel webRequestPanel = new JPanel();
    webRequestPanel.setLayout(new BorderLayout());
    webRequestPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("web_request"))); // $NON-NLS-1$

    JPanel northPanel = new JPanel();
    northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
    northPanel.add(getProtocolAndMethodPanel());
    northPanel.add(getPathPanel());//from   w w  w.  jav a2s. com

    webRequestPanel.add(northPanel, BorderLayout.NORTH);
    webRequestPanel.add(getParameterPanel(), BorderLayout.CENTER);

    this.add(getWebServerTimeoutPanel(), BorderLayout.NORTH);
    this.add(webRequestPanel, BorderLayout.CENTER);
    this.add(getProxyServerPanel(), BorderLayout.SOUTH);
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java

/**
 * Create a panel containing the webserver (domain+port) and timeouts (connect+request).
 *
 * @return the panel//from  w ww .j  a va2  s .c om
 */
protected final JPanel getWebServerTimeoutPanel() {
    // WEB SERVER PANEL
    JPanel webServerPanel = new HorizontalPanel();
    webServerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("web_server"))); // $NON-NLS-1$
    final JPanel domainPanel = getDomainPanel();
    final JPanel portPanel = getPortPanel();
    webServerPanel.add(domainPanel, BorderLayout.CENTER);
    webServerPanel.add(portPanel, BorderLayout.EAST);

    JPanel timeOut = new HorizontalPanel();
    timeOut.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("web_server_timeout_title"))); // $NON-NLS-1$
    final JPanel connPanel = getConnectTimeOutPanel();
    final JPanel reqPanel = getResponseTimeOutPanel();
    timeOut.add(connPanel);
    timeOut.add(reqPanel);

    JPanel webServerTimeoutPanel = new VerticalPanel();
    webServerTimeoutPanel.add(webServerPanel, BorderLayout.CENTER);
    webServerTimeoutPanel.add(timeOut, BorderLayout.EAST);

    JPanel bigPanel = new VerticalPanel();
    bigPanel.add(webServerTimeoutPanel);
    return bigPanel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java

/**
 * Create a panel containing the proxy server details
 *
 * @return the panel//w w w. ja v a 2s. com
 */
protected final JPanel getProxyServerPanel() {
    JPanel proxyServer = new HorizontalPanel();
    proxyServer.add(getProxyHostPanel(), BorderLayout.CENTER);
    proxyServer.add(getProxyPortPanel(), BorderLayout.EAST);

    JPanel proxyLogin = new HorizontalPanel();
    proxyLogin.add(getProxyUserPanel());
    proxyLogin.add(getProxyPassPanel());

    JPanel proxyServerPanel = new HorizontalPanel();
    proxyServerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("web_proxy_server_title"))); // $NON-NLS-1$
    proxyServerPanel.add(proxyServer);
    proxyServerPanel.add(proxyLogin);

    return proxyServerPanel;
}