Code example for JLabel

Methods: setLabelFor

0
     * 
     * @return a GUI panel containing the password field 
     */ 
    private JPanel createPasswordPanel() {
        JPanel panel = new JPanel(new BorderLayout(5, 0));
        JLabel label = new JLabel(JMeterUtils.getResString("password")); // $NON-NLS-1$
        label.setLabelFor(password);
        panel.add(label, BorderLayout.WEST);
        panel.add(password, BorderLayout.CENTER);
        return panel;
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java