【问题标题】:Is it possible to get an older Windows version Look-and-Feel in Windows 10?是否可以在 Windows 10 中获得较旧的 Windows 版本外观?
【发布时间】:2019-02-06 22:25:58
【问题描述】:
我使用的是 Windows 10,并且我有一个 javax.swing 应用程序,它的默认外观是 Windows 10。我想用旧的 Windows 外观装饰我的应用程序。
这段代码
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception ex) {
}
它只会返回 Windows 10 的外观。
是否有可能获得旧窗口的外观和感觉?
【问题讨论】:
标签:
java
windows
swing
user-interface
look-and-feel
【解决方案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 );
}
}
}