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:org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.java

/**
 * Initialize the GUI./*w w w  . ja  v a  2 s.com*/
 */
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    setLayout(new GridBagLayout());

    GridBagConstraints cl = new GridBagConstraints(); // for labels
    cl.gridx = 0;
    cl.anchor = GridBagConstraints.EAST;
    cl.insets = new Insets(0, 1, 0, 1);

    GridBagConstraints ce = new GridBagConstraints(); // for editors
    ce.fill = GridBagConstraints.BOTH;
    ce.gridx = 1;
    ce.weightx = 1.0;
    ce.insets = new Insets(0, 1, 0, 1);

    GridBagConstraints cp = new GridBagConstraints(); // for panels
    cp.fill = GridBagConstraints.BOTH;
    cp.gridx = 1;
    cp.gridy = GridBagConstraints.RELATIVE;
    cp.gridwidth = 2;
    cp.weightx = 1.0;

    JPanel currentPanel = this;
    String currentGroup = DEFAULT_GROUP;
    int y = 0;

    for (int i = 0; i < editors.length; i++) {
        if (editors[i] == null) {
            continue;
        }

        if (log.isDebugEnabled()) {
            log.debug("Laying property " + descriptors[i].getName());
        }

        String g = group(descriptors[i]);
        if (!currentGroup.equals(g)) {
            if (currentPanel != this) {
                add(currentPanel, cp);
            }
            currentGroup = g;
            currentPanel = new JPanel(new GridBagLayout());
            currentPanel.setBorder(
                    BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), groupDisplayName(g)));
            cp.weighty = 0.0;
            y = 0;
        }

        Component customEditor = editors[i].getCustomEditor();

        boolean multiLineEditor = false;
        if (customEditor.getPreferredSize().height > 50 || customEditor instanceof JScrollPane
                || descriptors[i].getValue(MULTILINE) != null) {
            // TODO: the above works in the current situation, but it's
            // just a hack. How to get each editor to report whether it
            // wants to grow bigger? Whether the property label should
            // be at the left or at the top of the editor? ...?
            multiLineEditor = true;
        }

        JLabel label = createLabel(descriptors[i]);
        label.setLabelFor(customEditor);

        cl.gridy = y;
        cl.gridwidth = multiLineEditor ? 2 : 1;
        cl.anchor = multiLineEditor ? GridBagConstraints.CENTER : GridBagConstraints.EAST;
        currentPanel.add(label, cl);

        ce.gridx = multiLineEditor ? 0 : 1;
        ce.gridy = multiLineEditor ? ++y : y;
        ce.gridwidth = multiLineEditor ? 2 : 1;
        ce.weighty = multiLineEditor ? 1.0 : 0.0;

        cp.weighty += ce.weighty;

        currentPanel.add(customEditor, ce);

        y++;
    }
    if (currentPanel != this) {
        add(currentPanel, cp);
    }

    // Add a 0-sized invisible component that will take all the vertical
    // space that nobody wants:
    cp.weighty = 0.0001;
    add(Box.createHorizontalStrut(0), cp);
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

private JPanel createGraphSettingsPane() {
    JPanel settingsPane = new JPanel(new BorderLayout());
    settingsPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("graph_resp_time_settings_pane"))); // $NON-NLS-1$

    JPanel intervalPane = new JPanel();
    intervalPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    intervalField.setText(String.valueOf(DEFAULT_INTERVAL));
    intervalPane.add(intervalField);/*from   w  ww  .  j av a 2  s .c  om*/

    // Button
    intervalButton.setFont(FONT_SMALL);
    intervalButton.addActionListener(this);
    intervalPane.add(intervalButton);

    settingsPane.add(intervalPane, BorderLayout.NORTH);
    settingsPane.add(createGraphSelectionSubPane(), BorderLayout.SOUTH);

    return settingsPane;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

private JPanel createGraphTitlePane() {
    JPanel titleNamePane = new JPanel(new BorderLayout());
    syncWithName.setFont(FONT_SMALL);//from w w  w  . j  a  v  a2 s.  co m
    titleNamePane.add(graphTitle, BorderLayout.CENTER);
    titleNamePane.add(syncWithName, BorderLayout.EAST);

    JPanel titleStylePane = new JPanel();
    titleStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5));
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
            titleFontNameList));
    titleFontNameList.setSelectedIndex(DEFAULT_TITLE_FONT_NAME);
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
            titleFontSizeList));
    titleFontSizeList.setSelectedItem(StatGraphProperties.fontSize[DEFAULT_TITLE_FONT_SIZE]);
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
            titleFontStyleList));
    titleFontStyleList.setSelectedIndex(DEFAULT_TITLE_FONT_STYLE);

    JPanel titlePane = new JPanel(new BorderLayout());
    titlePane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_title_group"))); // $NON-NLS-1$
    titlePane.add(titleNamePane, BorderLayout.NORTH);
    titlePane.add(titleStylePane, BorderLayout.SOUTH);
    return titlePane;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

private JPanel createLinePane() {
    JPanel lineStylePane = new JPanel();
    lineStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    lineStylePane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("graph_resp_time_settings_line"))); // $NON-NLS-1$
    lineStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("graph_resp_time_stroke_width"), //$NON-NLS-1$
            strokeWidthList));/*from   w  w w . j  a  v a 2  s  .c om*/
    strokeWidthList.setSelectedItem(StatGraphProperties.strokeWidth[DEFAULT_STROKE_WIDTH_LIST]);
    lineStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("graph_resp_time_shape_label"), //$NON-NLS-1$
            pointShapeLine));
    pointShapeLine.setSelectedIndex(DEFAULT_LINE_SHAPE_POINT);
    return lineStylePane;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

private JPanel createGraphDimensionPane() {
    JPanel dimensionPane = new JPanel();
    dimensionPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    dimensionPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_dimension"))); // $NON-NLS-1$

    dimensionPane.add(dynamicGraphSize);
    dynamicGraphSize.setSelected(DEFAULT_DYNAMIC_GRAPH_SIZE);
    graphWidth.setEnabled(false);//  w ww  . j  a va2  s.com
    graphHeight.setEnabled(false);
    dynamicGraphSize.addActionListener(this);
    dimensionPane.add(Box.createRigidArea(new Dimension(10, 0)));
    dimensionPane.add(graphWidth);
    dimensionPane.add(Box.createRigidArea(new Dimension(5, 0)));
    dimensionPane.add(graphHeight);
    return dimensionPane;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

/**
 * Create pane for X Axis options/*from  www  .j a  v  a 2 s .  c o  m*/
 * @return X Axis pane
 */
private JPanel createGraphXAxisPane() {
    JPanel xAxisPane = new JPanel();
    xAxisPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    xAxisPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_xaxis_group"))); // $NON-NLS-1$
    xAxisTimeFormat.setText(DEFAULT_XAXIS_TIME_FORMAT); // $NON-NLS-1$
    xAxisPane.add(xAxisTimeFormat);
    return xAxisPane;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

/**
 * Create pane for Y Axis options/*from  w  w w . j  av  a2s  .c om*/
 * @return Y Axis pane
 */
private JPanel createGraphYAxisPane() {
    JPanel yAxisPane = new JPanel();
    yAxisPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    yAxisPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_yaxis_group"))); // $NON-NLS-1$
    yAxisPane.add(maxValueYAxisLabel);
    yAxisPane.add(incrScaleYAxis);
    yAxisPane.add(numberShowGrouping);
    return yAxisPane;
}

From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java

/**
 * Create pane for legend settings/* w w w.  j av  a  2  s.  c o m*/
 * @return Legend pane
 */
private JPanel createLegendPane() {
    JPanel legendPanel = new JPanel();
    legendPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    legendPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_legend"))); // $NON-NLS-1$

    legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_legend_placement"), //$NON-NLS-1$
            legendPlacementList));
    legendPlacementList.setSelectedIndex(DEFAULT_LEGEND_PLACEMENT);
    legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
            fontNameList));
    fontNameList.setSelectedIndex(DEFAULT_LEGEND_FONT);
    legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
            fontSizeList));
    fontSizeList.setSelectedItem(StatGraphProperties.fontSize[DEFAULT_LEGEND_SIZE]);
    legendPanel.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
            fontStyleList));
    fontStyleList.setSelectedIndex(DEFAULT_LEGEND_STYLE);

    return legendPanel;
}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

private JPanel createGraphColumnPane() {
    JPanel colPanel = new JPanel();
    colPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));

    JLabel label = new JLabel(JMeterUtils.getResString("aggregate_graph_columns_to_display")); //$NON-NLS-1$
    colPanel.add(label);// w  w  w  .  ja v a  2s .com
    for (BarGraph bar : eltList) {
        colPanel.add(bar.getChkBox());
        colPanel.add(createColorBarButton(bar, eltList.indexOf(bar)));
    }
    colPanel.add(Box.createRigidArea(new Dimension(5, 0)));
    chooseForeColor.setFont(FONT_SMALL);
    colPanel.add(chooseForeColor);
    chooseForeColor.addActionListener(this);

    JPanel optionsPanel = new JPanel();
    optionsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    optionsPanel.add(createGraphFontValuePane());
    optionsPanel.add(drawOutlinesBar);
    optionsPanel.add(numberShowGrouping);
    optionsPanel.add(valueLabelsVertical);

    JPanel barPane = new JPanel(new BorderLayout());
    barPane.add(colPanel, BorderLayout.NORTH);
    barPane.add(Box.createRigidArea(new Dimension(0, 3)), BorderLayout.CENTER);
    barPane.add(optionsPanel, BorderLayout.SOUTH);

    JPanel columnPane = new JPanel(new BorderLayout());
    columnPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_column_settings"))); // $NON-NLS-1$
    columnPane.add(barPane, BorderLayout.NORTH);
    columnPane.add(Box.createRigidArea(new Dimension(0, 3)), BorderLayout.CENTER);
    columnPane.add(createGraphSelectionSubPane(), BorderLayout.SOUTH);

    return columnPane;
}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

private JPanel createGraphTitlePane() {
    JPanel titleNamePane = new JPanel(new BorderLayout());
    syncWithName.setFont(new Font("SansSerif", Font.PLAIN, 10));
    titleNamePane.add(graphTitle, BorderLayout.CENTER);
    titleNamePane.add(syncWithName, BorderLayout.EAST);

    JPanel titleStylePane = new JPanel();
    titleStylePane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 5));
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_font"), //$NON-NLS-1$
            titleFontNameList));/*  ww  w  .  ja v a 2  s. co m*/
    titleFontNameList.setSelectedIndex(0); // default: sans serif
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_size"), //$NON-NLS-1$
            titleFontSizeList));
    titleFontSizeList.setSelectedItem(StatGraphProperties.fontSize[6]); // default: 16
    titleStylePane.add(GuiUtils.createLabelCombo(JMeterUtils.getResString("aggregate_graph_style"), //$NON-NLS-1$
            titleFontStyleList));
    titleFontStyleList.setSelectedItem(JMeterUtils.getResString("fontstyle.bold")); // $NON-NLS-1$ // default: bold

    JPanel titlePane = new JPanel(new BorderLayout());
    titlePane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("aggregate_graph_title_group"))); // $NON-NLS-1$
    titlePane.add(titleNamePane, BorderLayout.NORTH);
    titlePane.add(titleStylePane, BorderLayout.SOUTH);
    return titlePane;
}