发布网友 发布时间:2022-05-25 09:08
共2个回答
热心网友 时间:2024-08-05 07:28
1.下载substance.jar
现在最新的版本已经出到4.3了,而且更新很快
2.将substance.jar添加到类路径中
3.将下列代码添加到程序的主执行类的main()方法中:
热心网友 时间:2024-08-05 07:29
Substance 这个项目的目的是提供一个流行的外观(look & feel)。这个外观(look & feel)联合了Windows XP和MacOS 10.4最好的特性并且需要JDK 5.0以上 将下列jar文件拷贝到你的程序的classpath中,然后将下列代码段加入到你main函数中 http://l1.edn.cn/cache/http/index.php?q=http%3A%2F%2F210.42.106.102%2Fbbs%2Fviewthread.php%3Ftid%3D111%26amp%3Bextra%3Dpage%253D1 (注,其实我在别的文章中给出了一个例子,参见用java打造任意形状窗口一文中的的代码) 1.substance look and feel: try { UIManager.setLookAndFeel(new SubstanceLookAndFeel()); UIManager.put("swing.boldMetal", false); if (System.getProperty("substancelaf.useDecorations") == null) { JFrame.setDefaultLookAndFeelDecorated(true); JDialog.setDefaultLookAndFeelDecorated(true); } System.setProperty("sun.awt.noerasebackground", "true"); SubstanceLookAndFeel.setCurrentTheme(new SubstanceLightAquaTheme());//设置当前的主题风格,同样我 们还可以设置当前的按钮形状,水印风格等等 } catch (Exception e) { System.err.println("Oops! Something went wrong!"); } 2.smooth look and feel try { UIManager.setLookAndFeel(new SmoothLookAndFeel()); UIManager.put("swing.boldMetal", false); } catch (Exception e) { System.err.println("Oops! Something went wrong!"); } 3. office/winxp/VisualStudio 2005 look and feel try { UIManager.setLookAndFeel("org.fife.plaf.Office2003.Office2003LookAndFeel"); //UIManager.setLookAndFeel("org.fife.plaf.OfficeXP.OfficeXPLookAndFeel"); //UIManager.setLookAndFeel("org.fife.plaf.VisualStudio2005.VisualStudio2005LookAndFeel"); UIManager.put("swing.boldMetal", false); } catch (Exception e) { System.err.println("Oops! Something went wrong!"); } 查看原帖>>