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






JCheckBox: setToolTipText(String text)

  


import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

public class Main extends JPanel {
  public Main() {
    JCheckBox m_chkBold = new JCheckBox("Bold");
    m_chkBold.setMnemonic('b');
    m_chkBold.setToolTipText("Bold font");
    add(m_chkBold);
    setBorder(new TitledBorder(new EtchedBorder(), "Effects"));
    JCheckBox m_chkItalic = new JCheckBox("Italic");
    m_chkItalic.setMnemonic('i');
    m_chkItalic.setToolTipText("Italic font");
    add(m_chkItalic);
    JCheckBox m_chkUnderline = new JCheckBox("Underline");
    m_chkUnderline.setMnemonic('u');
    m_chkUnderline.setToolTipText("Underline font");
    add(m_chkUnderline);
    JCheckBox m_chkStrikethrough = new JCheckBox("Strikethrough");
    m_chkStrikethrough.setMnemonic('r');
    m_chkStrikethrough.setToolTipText("Strikethrough font");
    add(m_chkStrikethrough);
    JCheckBox m_chkSubscript = new JCheckBox("Subscript");
    m_chkSubscript.setMnemonic('t');
    m_chkSubscript.setToolTipText("Subscript font");
    add(m_chkSubscript);
    JCheckBox m_chkSuperscript = new JCheckBox("Superscript");
    m_chkSuperscript.setMnemonic('p');
    m_chkSuperscript.setToolTipText("Superscript font");
    add(m_chkSuperscript);

  }

  public static void main(String[] a) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.add(new Main());
    f.pack();
    f.setSize(new Dimension(300, 200));
    f.setVisible(true);

  }
}

   
    
  








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: setText(String text) (HTML)