Mega Code Archive

 
Categories / Java Tutorial / Swing
 

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);   } }