import java.awt.ComponentOrientation;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing
If you want all JOptionPane
s to have the same font style and size, you can change the property of the UIManager
with:
javax.swing.UIManager.put("OptionPane.font", new Font("yourFontName", Font.BOLD, 30));
To get a list of the available font names, use the following snippet:
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontNames = ge.getAvailableFontFamilyNames();
for (int index = 0; index < fontNames.length; index++)
{
System.out.println(fontNames[index]);
}
One of the easiest ways is to use HTML directly in the String literal. For example:
"MINES AND GEOSCIENCES BUREAU - REGION XI, DAVAO CITY\n"
Can easily become:
"<html><span style='font-size:2em'>MINES AND GEOSCIENCES BUREAU - REGION XI, DAVAO CITY"
Note that when you use HTML, you can no longer use \n
for new lines. Use <br>
instead.