UI Windows 8 Look in JAVA
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21424893/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
UI Windows 8 Look in JAVA
提问by harraypotter
Im creating a system that is standalone and not online. It is a java based system. I just want to make my UI look like those in Windows 8. Will that be possible?
我正在创建一个独立且不在线的系统。它是一个基于java的系统。我只是想让我的 UI 看起来像 Windows 8 中的那些。这可能吗?
回答by Holger
If you use Swing, just add the following lines to the beginning of your program:
如果您使用 Swing,只需在程序的开头添加以下几行:
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e){}// if it fails, your program might look ugly but still work
This just tells Swing to use a look and feel that matches the System. I.e. if your program runs on Windows?8, the look and feel will be that of Windows?8.
这只是告诉 Swing 使用与系统匹配的外观。即,如果您的程序在 Windows?8 上运行,则外观和感觉将与 Windows?8 相同。
The JRE should not be too old for that. Note, that this means the Desktop's Look&Feel, not the Metro Style as with the standard JRE the Java applications will run as desktop applications not Metro apps. But using these line above you have done everything necessary to look like a Metro app if there will be a Metro-App JRE in the future.
JRE 不应该太旧。请注意,这意味着桌面的外观和感觉,而不是 Metro 风格,因为标准 JRE 中 Java 应用程序将作为桌面应用程序而不是 Metro 应用程序运行。但是,如果将来会有 Metro-App JRE,使用上面的这些行,您已经完成了看起来像 Metro 应用程序所需的一切。
回答by jeroen_de_schutter
Using Java FX and CSS you can mimic the Windows 8 Metro interface.
使用 Java FX 和 CSS,您可以模仿 Windows 8 Metro 界面。
See here : http://code.makery.ch/java/javafx-2-tutorial-part4
见这里:http: //code.makery.ch/java/javafx-2-tutorial-part4
Or here : http://pixelduke.wordpress.com/