Can I use Windows Look-and-Feel on a Unix (Linux/Solaris/HP-UX) platform?

Scott Stanchfield

There are two parts to this answer:

  1. Yes
  2. No

The answer depends on what you want to do with it. The license states that you cannot deliver an application using the Windows look and feel to non-windows platforms. Sun did this to protect against possible "look and feel" lawsuits that Microsoft might raise during the early development of Swing. By restricting the license to say "Windows look and feel can only be delivered on Windows", the thought was that M$ wouldn't be able to sue to stop Swing development.

Note that I said "deliver".

The key to making this work is that the WindowsLookAndFeel class has the following methods:
  public boolean isNativeLookAndFeel() {
    String osName = System.getProperty("os.name");
    return (osName != null) && (osName.indexOf("Windows") != -1);

  public boolean isSupportedLookAndFeel() {
    return isNativeLookAndFeel();

Obviously, the way the code is written prevents it from being used on non-windows platforms.

You can get around this by either subclassing WindowsLookAndFeel, overriding isSupportedLookAndFeel() to return true, or by placing an appropriately modified WindowsLookAndFeel class in the boot class path when you run your application. (See the -Xbootclasspath option for Sun's JRE).

However, make sure you pay close attention to the license. You cannot distribute this kind of change. It's only ok on your machine.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.