Jide componets (SplitButton) and UIManager.getDefaults

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Jide componets (SplitButton) and UIManager.getDefaults

Postby rustem » Thu Jul 16, 2009 11:39 am

Hello,
I'm using Windows L&F and trying to change fontsize with UIManager defaults table (global font change before visual components realization).
Unfortunatelly font size chages get apply only to part of JideSplitButton (menu part, but not to button component).
Is there any solution to keep font size on composite components in sync with UIManager default table?
Thanks,
rustem
 
Posts: 3
Joined: Thu Jul 16, 2009 11:23 am

Re: Jide componets (SplitButton) and UIManager.getDefaults

Postby JIDE Support » Thu Jul 16, 2009 11:52 am

Do you have a test case for it? I tried to use jide.fontSize system property and set it to 16. The font used by JideSplitPane changes too.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide componets (SplitButton) and UIManager.getDefaults

Postby rustem » Thu Jul 16, 2009 12:16 pm

Thanks for promt reply.
I do not use jide.fontSize property (shoud I?)
I use folowing to change font globally:
I wander if i need to instrust Jide components to get thier properties from UIManager defaults?
Thanks.
...
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
setGloabalFontSize(1.0f);
...

private static void setGloabalFontSize(float scale) {
UIDefaults defaults = UIManager.getDefaults();
Enumeration<Object> keys = defaults.keys();

while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object value = defaults.get(key);
if (value != null && value instanceof Font) {
UIManager.put(key, null);
Font font = UIManager.getFont(key);
if (font != null) {
float size = font.getSize2D();
Font newFont = font.deriveFont(size + scale);
UIManager.put(key, new FontUIResource(newFont));
}
}
}
}
rustem
 
Posts: 3
Joined: Thu Jul 16, 2009 11:23 am

Re: Jide componets (SplitButton) and UIManager.getDefaults

Postby JIDE Support » Thu Jul 16, 2009 12:20 pm

If you just want to change the font, jide.fontSize property is good because it will cover all jide components. For swing components, you can still use uidefaults. JideSplitButton is using the font from UIDefault "JideSplitButton.font" so you don't need to explicitly doing it anything.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Re: Jide componets (SplitButton) and UIManager.getDefaults

Postby rustem » Thu Jul 16, 2009 12:34 pm

Thanks.
I end up with folowing and it works as I expected:
...
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
LookAndFeelFactory.installJideExtension(); // !! I need to tell Jide to go and collect properties from UIManage defaults.
...
setGloabalFontSize(1.2f);
...

Thanks for your help.
Regards, Rustem
rustem
 
Posts: 3
Joined: Thu Jul 16, 2009 11:23 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 81 guests