开发者

How to adjust JFrame border thickness in Java

I'm using Vista, my old Java app ran on Win XP has thin borders, about 2 pixels thick, but now on Vista, the borders deafults to thick lines, maybe 6,7 pixels thick, can 开发者_StackOverflow社区I specify in Java how thick my JFrame borders should be ?


By default borders are handled by the native windowing system. But in the JFrame API there is a method setDefaultLookAndFeelDecorated(boolean). It says that if set to true and if the current look and feel supports it, it will use the look and feel to draw the borders, title and buttons. I haven't ever tried this, since I don't know which look and feels support decoration. The first thing would be to find one that does, then set that via the UIManager or command-line -Ddefault.laf argument, and turn on look and feel decoration via the JFrame method.

If you use this option though, you'll probably get non-standard looking window decoration. Given the little bits of Vista eye candy (glow on hover over the buttons and the translucent title bar), are you sure you want to do that?

Another option is to use the JFrame.setUndecorated(boolean) method and handle rendering of borders, title bar, etc. yourself, but that's probably even more difficult.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜