Using HTML in Swing Components - Java Swing

Java examples for Swing:Swing HTML

Introduction

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

Related Tutorials