I'm using Netbeans IDE 11.2 and i was wondering if there was anything i could do to change the Jlabel font from the stock windows fonts, (I have several fonts installed already).
Asked
Active
Viewed 246 times
-1
-
Does this answer your question? [Change font of JLabel](https://stackoverflow.com/questions/7859551/change-font-of-jlabel) – anastaciu Jan 28 '20 at 20:34
-
1[setFont](https://docs.oracle.com/en/java/javase/13/docs/api/java.desktop/javax/swing/JComponent.html#setFont(java.awt.Font))? – user85421 Jan 28 '20 at 20:44
2 Answers
0
Regardless of IDE you can do it in your code view like this.
JLabel label = new JLabel("First Name");
label.setFont(new Font("Courier New", Font.ITALIC, 12));
label.setForeground(Color.GRAY);

Dylan
- 2,161
- 2
- 27
- 51
-2
You could subclass JLabel and change the font in the constructor of your modified component. The link below explains how to include custom components in the NetBeans palette (beware, it's quite old):

roger_rfa
- 17
- 2