更改Java中的默认按钮,使它们看起来“更好". [英] Change Default Buttons in Java to Make Them Look "Better"

查看:97
本文介绍了更改Java中的默认按钮,使它们看起来“更好".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实质上是在尝试模仿默认的Windows XP简单计算器.当我在Java中更改按钮的背景色时,它看上去非常平坦且无聊".我想使按钮看起来尽可能接近Windows XP计算器中的按钮.

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.

以下是将我的图像与WinXp的图像进行比较的图像:

Here is an image comparing mine to WinXp's:

是否可以使用某种方法来更改按钮的样式,就像在Visual Basic中所做的那样,以使按钮几乎弹出更多或看起来像Windows Xp计算器那样的3D.

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.

Java中的默认按钮是我在寻找的东西,除了没有白色以外,还有更多的蓝色渐变色.

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?

推荐答案

尝试在主要方法的开头设置系统外观:

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

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

这将加载所有具有本机外观的Swing小部件.

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

如果您对使用此命令的实际操作有所了解,Oracle将提供有关外观的不错的教程:

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

这篇关于更改Java中的默认按钮,使它们看起来“更好".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆