Supporting HTML text : AbstractButton « Swing « Java Tutorial






Supporting HTML text
import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFrame;

public class HTMLDemoAbstractButton {

  public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    AbstractButton bn = new JButton();
    bn.setText ("<html>Last Name<br><font face='courier new'"
        + " color=red> (mandatory) </font></html>");
    frame.add(bn);

    frame.setSize(300, 200);
    frame.setVisible(true);
  }

}








14.4.AbstractButton
14.4.1.AbstractButton: parent class for JButtonAbstractButton: parent class for JButton
14.4.2.Supporting HTML textSupporting HTML text
14.4.3.Constants for AbstractButton PropertyChangeListener
14.4.4.Adding PropertyChangeListener to AbstractButtonAdding PropertyChangeListener to AbstractButton
14.4.5.AbstractButton Positioning