Change font of JLabel

hudi picture hudi · Oct 22, 2011 · Viewed 19.9k times · Source

how to change Font of JLabel ? I try this but with no succes:

JLabel nadpis = new JLabel(); 
nadpis.setFont(new Font("Papyrus", Font.ITALIC, 100)); 
nadpis.setText("hi");

Just size is changed but Font is still same

Answer

Andrew Thompson picture Andrew Thompson · Oct 22, 2011

I didn't see papyrus in my available fonts. How can I add it?

Look in the Font methods for the createFont() variants.