I know how to change the font for an individual component, but I would like to have one font used for every component in my Swing Application. Can someone tell me how to do this. Thanks
Ok, I think I have found out a way to do this. But you have to do it for each component. For example, to make a universal font for a JButton I create a new class called buttonFontSetter and extend JButton then I set my font in that class and call that method instead of JButton to create my buttons. I would have to do the same for my TextFields, Labels, etc. But it works. Just now I have to go and change all my JButton calls. EEKK! Oh well. Such is the life of a programmer. Ta Ta
------------------ Happy Coding, Gregg Bolinger
Renee Zhang
Ranch Hand
Joined: Sep 10, 2001
Posts: 72
posted
0
If I need one font for several components, I'd like to create a font object. For example: Font customFont = new Font("Dialog", 0, 14); //Then set component's font to customeFont buttonOne.setFont(customeFont); labelOne.setFont(customeFont); ..... I don't know if I can override something to change the default font. Does anyone know?
I would just like to know what the default font is in Windows so that I can set that as the default so that when I take my App over to Linux, it looks the same. As it is now, the font is spaced and seized different and appears larger. ------------------ Happy Coding, Gregg Bolinger
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
I don't think that there is a quarantee that it will look alike. Even with the same font and size.