Java tutorial
import java.awt.FlowLayout; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import javax.swing.JButton; import javax.swing.JFrame; public class HtmlButtons extends JFrame { public HtmlButtons() { super("HTML Buttons"); setSize(400, 300); getContentPane().setLayout(new FlowLayout()); String htmlText = "<html><p><font color=\"#800080\" " + "size=\"4\" face=\"Verdana\">JButton</font> </p>" + "<font size=\"2\"><em>" + "with HTML text</em></font></html>"; JButton btn = new JButton(htmlText); getContentPane().add(btn); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); } public static void main(String args[]) { new HtmlButtons(); } }