Java examples for Swing:Swing HTML
display the text "Close Window" on a JButton.
JButton b1 = new JButton("<html><b>Close</b> Window</html>");
Java can disable the default HTML interpretation using the html.disable component's client property.
JButton b3 = new JButton(); b3.putClientProperty("html.disable", Boolean.TRUE); b3.setText("<html><body>HTML is disabled</body></html>");