JCheckBox: setText(String text) (HTML) : JCheckBox « javax.swing « Java by API






JCheckBox: setText(String text) (HTML)

  


import javax.swing.JCheckBox;

public class Main {
  public static void main(String[] argv) throws Exception {
    JCheckBox checkbox = new JCheckBox();

    String label = "<html><table cellpadding=0><tr><td><img src=file:"
        + "icon.gif" + "/></td><td width=" + 3 + "><td>"

        // Retrieve the current label text
        + checkbox.getText() + "</td></tr></table></html>";

    // Add the icon
    checkbox.setText(label);

  }
}

   
    
  








Related examples in the same category

1.new JCheckBox(Action a)
2.new JCheckBox(String text)
3.new JCheckBox(String text, boolean selected)
4.new JCheckBox(String text, Icon normal)
5.JCheckBox: addActionListener(ActionListener lis)
6.JCheckBox: addChangeListener(ChangeListener lis)
7.JCheckBox: addComponentListener(ComponentListener l)
8.JCheckBox: addItemListener(ItemListener lis)
9.JCheckBox: isSelected()
10.JCheckBox: setBorderPaintedFlat(boolean b)
11.JCheckBox: setDisabledIcon(Icon disabledIcon)
12.JCheckBox: setDisabledSelectedIcon(Icon disabledSelectedIcon)
13.JCheckBox: setEnabled(boolean b)
14.JCheckBox: setIcon(Icon defaultIcon)
15.JCheckBox: setMnemonic(int mnemonic)
16.JCheckBox: setPressedIcon(Icon pressedIcon)
17.JCheckBox: setRolloverIcon(Icon i)
18.JCheckBox: setRolloverSelectedIcon(Icon rolloverSelectedIcon)
19.JCheckBox: setSelected(boolean b)
20.JCheckBox: setSelectedIcon(Icon i)
21.JCheckBox: setToolTipText(String text)