Java Swing Mac OSX标题栏 [英] Java Swing Mac OSX Title Bar

查看:133
本文介绍了Java Swing Mac OSX标题栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发OSX上的Java Swing应用程序,我希望它尽可能显示为Mac-Like。我已经实现了大部分想要的外观,但有一件事我仍然无法实现。

I am working on a Java Swing application on OSX and I want it to appear as Mac-Like as possible. I have achieved most of the desired look but one thing still eludes me.

这是标题栏。许多原生OSX应用程序都有一个带有工具栏按钮的高标题栏和一个用于在右上角切换显示/隐藏工具栏按钮的小按钮(请参阅FeedForAll应用程序的图像,该应用程序是Java但使用SWT) 。

It's the Title Bar. Many native OSX apps have a 'high' title bar with 'toolbar buttons' on it and a small button to toggle show/hide of the 'toolbar buttons' on the top right (see image of FeedForAll application which is Java but uses SWT).

如何实现这一目标?任何帮助或指针将不胜感激。

Any ideas how this can be achieved? Any help or pointers would be much appreciated.

推荐答案

在Swing中,实际上并未使用本机OS组件。 Mac上默认的Aqua外观尝试尽可能地匹配本机外观,但它实际上只是用Java2D绘制内容。因此,例如,默认按钮的脉冲发光未实现。

In Swing, native OS components are not actually used. The default "Aqua" look and feel on Mac tries to match the native look as well as possible, but it is really just painting things with Java2D. So, for example, the pulsing glow of the default button is not implemented.

您可以在窗口上设置一些客户端属性以影响其外观,但标题工具栏似乎不是一个选项:

There are some client properties you can set on the window to affect its appearance, but the "title toolbar" does not seem to be an option:

http://developer.apple.com/library/mac/#technotes/tn2007/tn2196.html#//apple_ref/doc/uid / DTS10004439

一种选择是切换到使用Quaqua外观。我自己没有使用它,但据说它比Maca更忠实于Mac外观。它有一个属性,您可以设置以获得所需的工具栏外观:

One option would be to switch to using the Quaqua look and feel. I haven't used it myself, but supposedly it is even more faithful to the Mac look than Aqua is. It has a property you can set to get the toolbar appearance you want:

http://www.randelshofer.ch/quaqua/guide/client_properties.html#JToolBar

这篇关于Java Swing Mac OSX标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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