java 窗口怎么美化

Python014

java 窗口怎么美化,第1张

可以设置LookAndFeel,通过第三方皮肤:

可选使用substance、JTattoo、liquidlnf等,我当前使用的是JTattoo的皮肤,swing/awt的默认皮肤确实是有点那个...LZ可以去G一下上述皮肤,你会发现你的界面会很NICE的.

如下代码是我使用JTattoo的SmartLookAndFeel主题皮肤的方法,GoodLuck!

Java code?

public static void main(String[] args) {

JFrame.setDefaultLookAndFeelDecorated(true)

JDialog.setDefaultLookAndFeelDecorated(true)

try {

SmartLookAndFeel.setTheme("Green")

SmartLookAndFeel lookFeel = new SmartLookAndFeel()

javax.swing.UIManager.setLookAndFeel(lookFeel)

} catch (Exception e) {

e.printStackTrace()

}

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new ToolMainFrame().setVisible(true)

}

})

使用Java的LookAndFeel设置,可以直接百度或Google一下,一般来说除非使用系统自带外观,否则需要下载jar包。

我比较推荐的是有Apple风格的QuaQuaLookAndFeel包,你可以查一下,下载后可直接放在工程中使用,很方便。

另外经常用到的较为权威的包是substance的外观优化,有很多如金属风格、复古风格等,

选择SWT/JFace吧,RCP插件式开发的效率也不是awt/Swing可以比的