Code example for JLabel

Methods: setBackgroundsetLabelFor

0
    } 
 
    public JLabeledTextField(String pLabel, Color bk) {
        super(); 
        mTextField = createTextField(20);
        mLabel = new JLabel(pLabel);
        mLabel.setBackground(bk);
        mLabel.setLabelFor(mTextField);
        this.setBackground(bk);
        init(); 
    } 
 
    /** 
     * Get the label {@link JLabel} followed by the text field @link {@link JTextField}. 
     */ 
    @Override 
    public List<JComponent> getComponentList() {
        List<JComponent> comps = new LinkedList<JComponent>();
        comps.add(mLabel);
        comps.add(mTextField);