Skip to main content

Colors from host system

4 replies [Last post]
zander
Offline
Joined: 2003-06-13

As an ongoing work on making my Swing GUIs integrate better with the surrounding system I am looking for ways to fetch the color profile of the current user.
I post this in the unix part since I work on Linux, but the question is just as much for any other OS.
If nothing else; I want to find out the color-settings from KDE, which IMO is the unix WM.

Any thoughts appriciated.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
zander
Offline
Joined: 2003-06-13

Hi Scott.

> I must admit I'm not familar with KDE/Qt, if it is
> similar to GTK then a straightforward lookup as is
> exposed by the UIDefaults is not possible. GTK allows
> you to customize the look based on containment
> hierarchy, class name or component name. This
> requires you to update the style associated with a
> component any time one of these changes, non
> trivial.

KDE does things a lot easier; there are groups of colors you can pick and alter. Much like Metal does.
So a color for all texts and a color for a 'link' etc.

> In 1.4.2 Swing will support a GTK look and feel. We
> parse the resource files used by GTK to get the look
> and update the style at the appropriate time. 1.4.2
> should GA (FCS) pretty soon and you can then dig out
> the code to see how we're doing this. In the mean
> time you may want to look at how skinlf (open sourced
> here) deals with KDE.

Ok, I'll look at skinlf.

Hmm, appears that skinlf only allows the old pixmaps 'skin' and does nothing with colors set by the user.

zander later realized that he allready looked at skinlf

scott.violet
Offline
Joined: 2006-02-17

I must admit I'm not familar with KDE/QT, if it is similar to GTK then a straightforward lookup as is exposed by the UIDefaults is not possible. GTK allows you to customize the look based on containment hierarchy, class name or component name. This requires you to update the style associated with a component any time one of these changes, non trivial.
In 1.4.2 Swing will support a GTK look and feel. We parse the resource files used by GTK to get the look and update the style at the appropriate time. 1.4.2 should GA (FCS) pretty soon and you can then dig out the code to see how we're doing this. In the mean time you may want to look at how skinlf (open sourced here) deals with KDE.

-Scott

Anonymous

As far as I know you can configure KDE to make other applications look like a KDE program. That can be configured somewhere in the control center. I haven't tried it, but it might work also with Java applications.

As a final step, if it is not working you may try to use the Simple Widget Toolkit (SWT) from the Eclipse projekt. SWT hast a native look for Windows, Linux and MacOS machines. But I don't like the current performance under Linux. Anyway, the native widgeds are based on GTK, but with SWT it works like described above to make your app look like a KDE application.

Anyone experiences with Swing and KDE?

zander
Offline
Joined: 2003-06-13

> As far as I know you can configure KDE to make other
> applications look like a KDE program. That can be
> configured somewhere in the control center.
Yes, in the 'Colors' KCM.
> I haven't
> tried it, but it might work also with Java
> applications.

It doesn't
Java does not ask X11 for colors, so it does not effect Java.

> As a final step, if it is not working you may try to
> use the Simple Widget Toolkit (SWT) from the Eclipse
> projekt. SWT hast a native look for Windows, Linux
> and MacOS machines. But I don't like the current
> performance under Linux.

Last time I tried SWT it was not very finished and while I have some bones to pick with Swing, I like it a lot better. If for no other reason than that I put a lot of effort into creating nice Swing widgets :)
Thanx for the pointer though!