Example usage for javax.swing JLabel setLabelFor

List of usage examples for javax.swing JLabel setLabelFor

Introduction

In this page you can find the example usage for javax.swing JLabel setLabelFor.

Prototype

@BeanProperty(description = "The component this is labelling.")
public void setLabelFor(Component c) 

Source Link

Document

Set the component this is labelling.

Usage

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

private JPanel getDomainPanel() {
    domain = new JTextField(20);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_domain")); // $NON-NLS-1$
    label.setLabelFor(domain);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(domain, BorderLayout.CENTER);
    return panel;
}

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

private JPanel getProxyHostPanel() {
    proxyHost = new JTextField(10);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_domain")); // $NON-NLS-1$
    label.setLabelFor(proxyHost);
    label.setFont(FONT_SMALL);//  w  w  w .ja  va2  s .c  o  m

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(proxyHost, BorderLayout.CENTER);
    return panel;
}

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

private JPanel getProxyUserPanel() {
    proxyUser = new JTextField(5);

    JLabel label = new JLabel(JMeterUtils.getResString("username")); // $NON-NLS-1$
    label.setLabelFor(proxyUser);
    label.setFont(FONT_SMALL);//www . j a  va  2  s .  c  o  m

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(proxyUser, BorderLayout.CENTER);
    return panel;
}

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

private JPanel getProxyPassPanel() {
    proxyPass = new JPasswordField(5);

    JLabel label = new JLabel(JMeterUtils.getResString("password")); // $NON-NLS-1$
    label.setLabelFor(proxyPass);
    label.setFont(FONT_SMALL);/*from w  ww  .jav  a2  s. co  m*/

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(proxyPass, BorderLayout.CENTER);
    return panel;
}

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

/**
 * This method defines the Panel for the HTTP path, 'Follow Redirects'
 * 'Use KeepAlive', and 'Use multipart for HTTP POST' elements.
 *
 * @return JPanel The Panel for the path, 'Follow Redirects' and 'Use
 *         KeepAlive' elements.//  ww  w . j a va 2  s . c  o  m
 */
protected Component getPathPanel() {
    path = new JTextField(15);

    JLabel label = new JLabel(JMeterUtils.getResString("path")); //$NON-NLS-1$
    label.setLabelFor(path);

    if (notConfigOnly) {
        followRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects")); // $NON-NLS-1$
        followRedirects.setFont(null);
        followRedirects.setSelected(true);
        followRedirects.addChangeListener(this);

        autoRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects_auto")); //$NON-NLS-1$
        autoRedirects.setFont(null);
        autoRedirects.addChangeListener(this);
        autoRedirects.setSelected(false);// Default changed in 2.3 and again in 2.4

        useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive")); // $NON-NLS-1$
        useKeepAlive.setFont(null);
        useKeepAlive.setSelected(true);

        useMultipartForPost = new JCheckBox(JMeterUtils.getResString("use_multipart_for_http_post")); // $NON-NLS-1$
        useMultipartForPost.setFont(null);
        useMultipartForPost.setSelected(false);

        useBrowserCompatibleMultipartMode = new JCheckBox(
                JMeterUtils.getResString("use_multipart_mode_browser")); // $NON-NLS-1$
        useBrowserCompatibleMultipartMode.setFont(null);
        useBrowserCompatibleMultipartMode
                .setSelected(HTTPSamplerBase.BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT);

    }

    JPanel pathPanel = new HorizontalPanel();
    pathPanel.add(label);
    pathPanel.add(path);

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(pathPanel);
    if (notConfigOnly) {
        JPanel optionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        optionPanel.setFont(FONT_SMALL); // all sub-components with setFont(null) inherit this font
        optionPanel.add(autoRedirects);
        optionPanel.add(followRedirects);
        optionPanel.add(useKeepAlive);
        optionPanel.add(useMultipartForPost);
        optionPanel.add(useBrowserCompatibleMultipartMode);
        optionPanel.setMinimumSize(optionPanel.getPreferredSize());
        panel.add(optionPanel);
    }

    return panel;
}

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

protected JPanel getProtocolAndMethodPanel() {

    // Implementation
    if (showImplementation) {
        httpImplementation = new JLabeledChoice(JMeterUtils.getResString("http_implementation"), // $NON-NLS-1$
                HTTPSamplerFactory.getImplementations());
        httpImplementation.addValue("");
    }/*w w w .j ava2 s.c  o  m*/

    // PROTOCOL
    protocol = new JTextField(4);
    JLabel protocolLabel = new JLabel(JMeterUtils.getResString("protocol")); // $NON-NLS-1$
    protocolLabel.setLabelFor(protocol);

    // CONTENT_ENCODING
    contentEncoding = new JTextField(10);
    JLabel contentEncodingLabel = new JLabel(JMeterUtils.getResString("content_encoding")); // $NON-NLS-1$
    contentEncodingLabel.setLabelFor(contentEncoding);

    if (notConfigOnly) {
        method = new JLabeledChoice(JMeterUtils.getResString("method"), // $NON-NLS-1$
                HTTPSamplerBase.getValidMethodsAsArray(), true, false);
        method.addChangeListener(this);
    }

    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));

    if (showImplementation) {
        panel.add(httpImplementation);
    }
    panel.add(protocolLabel);
    panel.add(protocol);
    panel.add(Box.createHorizontalStrut(5));

    if (notConfigOnly) {
        panel.add(method);
    }
    panel.setMinimumSize(panel.getPreferredSize());
    panel.add(Box.createHorizontalStrut(5));

    panel.add(contentEncodingLabel);
    panel.add(contentEncoding);
    panel.setMinimumSize(panel.getPreferredSize());
    return panel;
}

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

private JPanel getPortPanel() {
    port = new JTextField(4);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_port")); // $NON-NLS-1$
    label.setLabelFor(port);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(port, BorderLayout.CENTER);

    return panel;
}

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

private JPanel getProxyPortPanel() {
    proxyPort = new JTextField(4);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_port")); // $NON-NLS-1$
    label.setLabelFor(proxyPort);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(proxyPort, BorderLayout.CENTER);

    return panel;
}

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

private JPanel getConnectTimeOutPanel() {
    connectTimeOut = new JTextField(4);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_timeout_connect")); // $NON-NLS-1$
    label.setLabelFor(connectTimeOut);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(connectTimeOut, BorderLayout.CENTER);

    return panel;
}

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

private JPanel getResponseTimeOutPanel() {
    responseTimeOut = new JTextField(4);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_timeout_response")); // $NON-NLS-1$
    label.setLabelFor(responseTimeOut);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(responseTimeOut, BorderLayout.CENTER);

    return panel;
}