Results 1 to 5 of 5
- 09-26-2009, 02:18 AM #1
Member
- Join Date
- Sep 2009
- Posts
- 8
- Rep Power
- 0
Changing the default fonts via UIManager
My system look and feel is gtk. The default font is hideous. I have changed it on my system so I never see it, but Java still uses it. As far as I can tell this should work (to change the JLabel's), but it doesn't seem to have any effect.Java Code:public static void main(String[] args) { try { // Set System L&F UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { System.out.println("unsupported look and feel exception"); } catch (ClassNotFoundException e) { System.out.println("Class not found"); } catch (InstantiationException e) { System.out.println("instantiation exception"); } catch (IllegalAccessException e) { System.out.println("illegal access exception"); } Font defaultFont = new Font("Arial",Font.PLAIN,12); UIManager.put("Label.font", defaultFont); ...
- 09-26-2009, 04:08 AM #2
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,158
- Rep Power
- 5
What happens for other LAFs? Maybe GTK doesn't use the UIManager.
- 09-26-2009, 04:19 AM #3
Member
- Join Date
- Sep 2009
- Posts
- 8
- Rep Power
- 0
- 09-26-2009, 04:44 AM #4
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,158
- Rep Power
- 5
I guess. I don't know how the LAF works. You can try the UIManager Defaults program to see if it list any UIDefaults for the GTK LAF:Does this mean I cannot use this method to set a default font? Do I have to go through my program label by label?
tips4java.wordpress.com/2008/10/09/uimanager-defaults/
If not, then maybe the LAF itself has some methods that allow you to customize it.
- 09-26-2009, 06:48 PM #5
Member
- Join Date
- Sep 2009
- Posts
- 8
- Rep Power
- 0
Apparently the look and feel ignores the UIManager font altogether. I checked using the program you linked and my own code. The default is reading as "MS Sans Serif" (which is the font I set as my system default--I know, sacrilege, but it's a nice font). The look and feel uses something else, I believe the default linux font (can't remember what it's called).
Similar Threads
-
Changing default Applet Viewer Size?
By dsym@comcast.net in forum Java AppletsReplies: 6Last Post: 08-27-2010, 06:42 PM -
Fonts (Changing Fonts and Color's)
By dbashby in forum New To JavaReplies: 10Last Post: 04-06-2009, 01:32 AM -
how to get raw image data for fonts
By Nicholas Jordan in forum Java 2DReplies: 8Last Post: 04-05-2009, 06:15 AM -
[SOLVED] Access to default session deniedAccess to default session denied
By jazz2k8 in forum NetworkingReplies: 1Last Post: 03-10-2009, 01:12 PM -
Swing - Changing component default font
By Java Tip in forum Java TipReplies: 0Last Post: 03-11-2008, 10:52 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks