简体   繁体   English

用Java设置GUI组件样式的方法

[英]Methods of styling GUI components in java

I'm creating a user interface for a java standalone desktop application but the forms, text fields and tables I built using javax.swing and java.awt packages look quite dull. 我正在为Java独立桌面应用程序创建用户界面,但是我使用javax.swing和java.awt包构建的表单,文本字段和表看起来很沉闷。 Are there any methods by which these components can be stylized so that they look more appealing (like those beautiful websites made with css and javascript) ? 是否有任何方法可以使这些组件样式化,以使其看起来更具吸引力(例如,使用css和javascript创建的漂亮网站)?

You can set the background, border, foreground, etc of these components. 您可以设置这些组件的背景,边框,前景等。 Consult the API for useful functions. 请查阅API以获取有用的功能。

Or you can change the look and feel of your entire program. 或者,您可以更改整个程序的外观。 Recommended reading: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 推荐阅读: http : //docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

You could use Look and Feel, there are libraries that set your all your components with a defined style. 您可以使用外观,有一些库可以将所有组件设置为已定义的样式。

See this link http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html 看到此链接http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM