Hi, I'm trying to set custom fonts, I can do it without problem with this code:
InputStream is = this.getClass().getResourceAsStream("/src/someFontName.ttf");
Font f=null;
try {
f = Font.createFont(Font.TRUETYPE_FONT,is).deriveFont(15f);
} catch (FontFormatException ex) {
Logger.getLogger(PanelLiquidacion.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(PanelLiquidacion.class.getName()).log(Level.SEVERE, null, ex);
}
txtPlace=new JTextField();txtPlace.setBounds(185,10,310,20);
if(f!=null){
txtPlace.setFont(f);
lblPlace.setFont(f);
txtPlace.setForeground(Color.DARK_GRAY);
}
What I'm wondering is, can I set the font to all JTextFields, JLabel, and JTextPanes used in the program with a single method, or am I forced to do it this way?