用户界面:是否可以在Windows 10中获得较旧的Windows外观?

时间:2018-08-31 22:01:53

标签: java windows swing user-interface windows-look-and-feel

我正在使用Windows 10,并且有一个javax.swing应用程序,它的默认外观是Windows10。我想用较旧的Windows外观来装饰我的应用程序。

此代码

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} 
catch (Exception ex) {
}

它只会返回Windows 10的外观和感觉。

我的问题是,是否可以使旧的Windows外观和感觉?

1 个答案:

答案 0 :(得分:1)

运行代码对此进行测试时,将得到以下输出:

run:
javax.swing.UIManager$LookAndFeelInfo[Metal javax.swing.plaf.metal.MetalLookAndFeel]
javax.swing.UIManager$LookAndFeelInfo[Nimbus javax.swing.plaf.nimbus.NimbusLookAndFeel]
javax.swing.UIManager$LookAndFeelInfo[CDE/Motif com.sun.java.swing.plaf.motif.MotifLookAndFeel]
javax.swing.UIManager$LookAndFeelInfo[Windows com.sun.java.swing.plaf.windows.WindowsLookAndFeel]
javax.swing.UIManager$LookAndFeelInfo[Windows Classic com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel]

您似乎选择Windows 10和“经典”版本(可能更接近Windows的更早版本)。不幸的是,我认为您无所事事。

package quicktest;

import javax.swing.UIManager;

/**
 *
 * @author Brenden
 */
public class LookAndFeelTest {
   public static void main( String[] args ) {
      UIManager.LookAndFeelInfo info[] = UIManager.getInstalledLookAndFeels();
      for( int i = 0; i < info.length; i++ ) {
         UIManager.LookAndFeelInfo lookAndFeelInfo = info[i];
         System.out.println( lookAndFeelInfo );
      }
   }
}