如何添加一个看起来像苹果os按钮的按钮?

时间:2023-01-19 15:41:50

I am developing a RCP application where I want to add a button which look like apple os button. I want this look in windows7. Is this possible ?

我正在开发一个RCP应用程序,我想添加一个看起来像apple os按钮的按钮。我希望在windows7中看一下。这可能吗 ?

1 个解决方案

#1


0  

Yes it is possible, but as the commenters have mentioned, definitely not recommended. SWT will not support this out of the box, as it is designed to have native looking widgets on whatever platform it is running on.

是的,这是可能的,但正如评论者提到的,绝对不推荐。 SWT不支持开箱即用,因为它设计为在运行的任何平台上都具有原生外观的小部件。

Swing, on the other hand, supports many different types of "look and feel", since it is designed to look the same on whatever platform you are running on. It won't be perfect (since again, it's not the native widget), but it's easier than writing your own widget.

另一方面,Swing支持许多不同类型的“外观和感觉”,因为它设计为在您运行的任何平台上看起来都相同。它不会是完美的(因为它不是本机小部件),但它比编写自己的小部件更容易。

Your options are:

你的选择是:

  1. Use Swing for your widget. This related answer and this look and feel documentation are good starting points for doing this. There may be other look and feel implementations available that do a better job.
  2. 使用Swing为您的小部件。这个相关的答案和这个外观和感觉文档是这样做的良好起点。可能有其他外观和感觉实现可以做得更好。

  3. Write a custom SWT widget that happens to look and feel like the button you want. This is pretty much extending from either Composite or Canvas, and implementing all the painting and behaviors yourself.
  4. 编写一个自定义的SWT小部件,其外观和感觉就像您想要的按钮。这几乎从Composite或Canvas扩展,并自己实现所有绘画和行为。

Keep in mind that with both of these solutions, your button will very quickly look out of date on newer versions of the OS if the native rendering of the button has changed.

请记住,使用这两种解决方案,如果按钮的本机渲染已更改,则按钮将在新版本的操作系统上快速查看过时。

#1


0  

Yes it is possible, but as the commenters have mentioned, definitely not recommended. SWT will not support this out of the box, as it is designed to have native looking widgets on whatever platform it is running on.

是的,这是可能的,但正如评论者提到的,绝对不推荐。 SWT不支持开箱即用,因为它设计为在运行的任何平台上都具有原生外观的小部件。

Swing, on the other hand, supports many different types of "look and feel", since it is designed to look the same on whatever platform you are running on. It won't be perfect (since again, it's not the native widget), but it's easier than writing your own widget.

另一方面,Swing支持许多不同类型的“外观和感觉”,因为它设计为在您运行的任何平台上看起来都相同。它不会是完美的(因为它不是本机小部件),但它比编写自己的小部件更容易。

Your options are:

你的选择是:

  1. Use Swing for your widget. This related answer and this look and feel documentation are good starting points for doing this. There may be other look and feel implementations available that do a better job.
  2. 使用Swing为您的小部件。这个相关的答案和这个外观和感觉文档是这样做的良好起点。可能有其他外观和感觉实现可以做得更好。

  3. Write a custom SWT widget that happens to look and feel like the button you want. This is pretty much extending from either Composite or Canvas, and implementing all the painting and behaviors yourself.
  4. 编写一个自定义的SWT小部件,其外观和感觉就像您想要的按钮。这几乎从Composite或Canvas扩展,并自己实现所有绘画和行为。

Keep in mind that with both of these solutions, your button will very quickly look out of date on newer versions of the OS if the native rendering of the button has changed.

请记住,使用这两种解决方案,如果按钮的本机渲染已更改,则按钮将在新版本的操作系统上快速查看过时。