views:

137

answers:

2

I am calling UIManager.getSystemLookAndFeelClassName(). And get as result WindowsLookAndFeel, even when setting current theme to WindowsClassicLookAndFeel. But I expect WindowsClassicLookAndFeel. Question is how can I detect that windows classic theme is now active

+1  A: 

I'm not quite sure what you are asking.

If you are asking which theme/look and feel SWING is currently using, try UIManager.getSystemLookAndFeelClassName().

If you are trying to find out which theme Windows is using - I don't know. Probably not quite easy to find that out.

Edit: A quick hack might be (apart from using JNA/JNA to query some Windows API directly which theme is being used) would be creating a new JFrame, place it in some area, capture a small part of that border and compare it with samples of borders (which you need to create beforehand and ship with your code, as to be able to programmatically compare the just-taken-screen-capture-bit and all border-images you ship)

Tedil
yes, something like this, but there is com.sun.java.swing.plaf.windows.WindowsLookAndFeel and com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel, but UIManager.getSystemLookAndFeelClassName() returns only com.sun.java.swing.plaf.windows.WindowsLookAndFeel even when classic windows theme applied.
fland
You give a link to a javadoc without even reading what the method is doing.
tulskiy
@tulskiy fland recently rephrased his question, so I could only guess what he was asking for. Hence my answer doesn't make much sense anymore.
Tedil
+1  A: 

UIManager.getLookAndFeel() returns currently installed LaF. getSystemLookAndFeel() returns look and feel that would look as a current system's theme, e.g. WindowsLookAndFeel on windows GTKLookAndFeel on Linux MOtifLookAndFeel on Solaris etc.

tulskiy