如何使Java看起来像Windows程序?

时间:2022-08-24 21:13:49

Is there a way (using Java) to make the GUIs that you create look like normal Windows programs? I don't like the look and feel of the Java buttons and scrollers and stuff... It can use those if it's running on Mac or Linux, but I'd like it to inherit the buttons and stuff from Windows. Any suggestions?

有没有一种方法(使用Java)使您创建的gui看起来像普通的Windows程序?我不喜欢Java按钮和滚动条的外观和感觉……如果它在Mac或Linux上运行,它可以使用这些,但是我希望它继承Windows中的按钮和其他东西。有什么建议吗?

2 个解决方案

#1


34  

You can set the look and feel of any Swing program to the native operating system's with one call.

您可以通过一次调用将任何Swing程序的外观和感觉设置为本机操作系统。

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

The Windows PLAF can be seen in the Nested Layout Example.

在嵌套布局示例中可以看到Windows PLAF。

如何使Java看起来像Windows程序?

#2


-1  

Another solution could be to make your own theme (which would include making your own art assets) using Factories. (like BorderFactory etc.)

另一种解决方案是使用工厂制作你自己的主题(包括制作你自己的艺术资产)。(如BorderFactory等等)。

#1


34  

You can set the look and feel of any Swing program to the native operating system's with one call.

您可以通过一次调用将任何Swing程序的外观和感觉设置为本机操作系统。

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())

The Windows PLAF can be seen in the Nested Layout Example.

在嵌套布局示例中可以看到Windows PLAF。

如何使Java看起来像Windows程序?

#2


-1  

Another solution could be to make your own theme (which would include making your own art assets) using Factories. (like BorderFactory etc.)

另一种解决方案是使用工厂制作你自己的主题(包括制作你自己的艺术资产)。(如BorderFactory等等)。