XP laf not working with 1.4.2 & vista

I'm having trouble getting the XP look and feel on Vista with Java 1.4.2_14.

Buttons and toolbar buttons are the worst. They look like "classic windows" with ugly square borders.It's the same on most versions I've tried although 1.5.0_11 and 1.6 look fine.

Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive") returns null.

I'm not sure if this is relevant but I have to use sun.java2d.noddraw=true to avoid Vista switching to Basic Vista Basic Theme.

[502 byte] By [jamjima] at [2007-11-27 4:40:42]
# 1
Why are you trying to override the users settings
macrules2a at 2007-7-12 9:51:56 > top of Java-index,Desktop,Core GUI APIs...
# 2
How would you expect to get XP look under Vista? Windows LAF calls native libraries to paint the controls, and under Vista these are painted as Vista-looking. This, of course, applies to Java 6.0 and not Java 1.4.2, but i doubt that you can get the XP look under 1.4.2 running under Vista.
kirillga at 2007-7-12 9:51:57 > top of Java-index,Desktop,Core GUI APIs...
# 3

That's not really what I meant.

I've got a swing app running with Java 1.4.2_12 on Vista. The controls look like they are from windows classic.I would like them to look a bit like the native Vista controls.

When it runs on XP it looks like XP, when it runs on Linux it looks like metal, when it runs on Vista it looks rubbish.

jamjima at 2007-7-12 9:51:57 > top of Java-index,Desktop,Core GUI APIs...
# 4
I think it's only supported in 5.0 and 6.0.
kirillga at 2007-7-12 9:51:57 > top of Java-index,Desktop,Core GUI APIs...
# 5
Update to java 6
macrules2a at 2007-7-12 9:51:57 > top of Java-index,Desktop,Core GUI APIs...
# 6

they are Right it checks to see that the OS name is Windows XP i assume and it finds the windows but NOT the xp so it just assumes it is 98.... just my theroy

well not any more.!!! take a look and see ....

private static LookAndFeelInfo[] installedLAFs;

static {

ArrayList iLAFs = new ArrayList(4);

iLAFs.add(new LookAndFeelInfo(

"Metal", "javax.swing.plaf.metal.MetalLookAndFeel"));

iLAFs.add(new LookAndFeelInfo("CDE/Motif",

"com.sun.java.swing.plaf.motif.MotifLookAndFeel"));

// Only include windows on Windows boxs.

String osName = (String)AccessController.doPrivileged(

new GetPropertyAction("os.name"));

if (osName != null && osName.indexOf("Windows") != -1) {

iLAFs.add(new LookAndFeelInfo("Windows",

"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"));

if (Toolkit.getDefaultToolkit().getDesktopProperty(

"win.xpstyle.themeActive") != null) {

iLAFs.add(new LookAndFeelInfo("Windows Classic",

"com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"));

}

}

else {

// GTK is not shipped on Windows.

iLAFs.add(new LookAndFeelInfo("GTK+",

"com.sun.java.swing.plaf.gtk.GTKLookAndFeel"));

}

installedLAFs = (LookAndFeelInfo[])iLAFs.toArray(

new LookAndFeelInfo[iLAFs.size()]);

}

the OS is Windows but the XP theme is NOT on the computer!! so it goes back to cassic. hope this helps you,

ps that was code from UI Manager 1.5

Nibura at 2007-7-12 9:51:57 > top of Java-index,Desktop,Core GUI APIs...
# 7
I found that this is already an issue.Bug ids 2135111 & 5106661.This would imply that you need versions bigger than 1.5u8 to get native look and feel on Windows Vista. Thanks for the replies
jamjima at 2007-7-12 9:51:57 > top of Java-index,Desktop,Core GUI APIs...