Change Default Buttons in Java to Make Them Look “Better”

大憨熊 提交于 2019-12-19 05:45:17

问题


I'm essentially trying to mimic the default windows xp simple calculator. When I change the background colours of the buttons in Java it makes them look very flat and "boring". I want to make the buttons look as close as possible to the buttons in the Windows XP calculator.

Here is an image comparing mine to WinXp's:

Is there some kind of method I can use to change the style of the buttons much like you can do in Visual Basic to make the buttons almost pop more or look 3D like the Windows Xp Calculator.

The default buttons in Java are sort of what I'm looking for except there not white there more of a blue kind of colour in a gradient.

Is this possible, or am I stuck with ugly button?


回答1:


Try setting the system look and feel at the beginning of the main method:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

This will load all Swing widgets with a native-ish look.

If you are insterested in what you are actually doing with this command, Oracle has a nice tutorial regarding look and feels: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html



来源:https://stackoverflow.com/questions/10305170/change-default-buttons-in-java-to-make-them-look-better

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!