JButton text with different font family in different words
fonts, html, java, swing
Solution
May be the font tag attribute family is wrong!
It is indeed, the right tag should be:
<font face="Serif"></font>
Take a look to HTML font tag. So in your case:
JButton button = new JButton("<html>Hello <font face=\"Serif\">World</font></html>");
Picture
Problem
I am trying to achieve a button with its text having two different font family. I think, it can be achieved using HTML, as said on this page. http://docs.oracle.com/javase/tutorial/uiswing/components/html.html I've tried the following code, but it's not working. ``` JButton button = new JButton("<html>Hello <font family=Serif>World</font></html>"); ``` May be the `font` tag attribute `family` is wrong!