I've written an application in Swing
. For a JLabel
I'm using a certain font (Tekton Pro Ext
) which shows up properly on my computer. However, if someone else launches the program, the font may not be the same and then is replaced by a default one which I believe is Arial
. Also, I'm forcing the system's default look and feel by running the following code:
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e)
{
e.printStackTrace();
}
Is there a way I can fix this font issue in my application's code so that it shows for others as well? If not, how can clients assure that all fonts I can choose in Window Builder Pro
will also work for them?
JLabel myLabel = new JLabel("Hello world!");
myLabel.setFont(new Font("Tekton Pro Ext", Font.BOLD, 22));
I haven't installed a special fonts pack but it's working on my Windows 8.1
machine "by default" though. What could be the cause?