// ui/HTMLButton.java
// ©2015 MindView LLC: see Copyright.txt
// Putting HTML text on Swing components.
import javax.swing.*;
import java.awt.*;
import static com.mindviewinc.util.SwingConsole.*;
public class HTMLButton extends JFrame {
private JButton b = new JButton(
"" +
"
Hello!
Press me now!");
public HTMLButton() {
b.addActionListener(e -> {
add(new JLabel("" +
"Kapow!"));
// Force a re-layout to include the new label:
validate();
});
setLayout(new FlowLayout());
add(b);
}
public static void main(String[] args) {
run(new HTMLButton(), 200, 500);
}
}