setBezelStyle 不适用于 SWT NSButton - java
setBezelStyle not working on SWT NSButton - java
我正在创建一个 SWT(已移植 Mac OSX 版本)应用程序。我正在尝试将特定按钮设置为具有 "inline" 的边框样式。这是我希望我的按钮在 mac 上的样子。
(在 xcode 的故事板视图中截屏)
我用来尝试获取此内联按钮的代码:
// created button named "inlineButton" and applied layout to it.
// here is where I set the bezel style and text.
NSButton nsInlineButton = (NSButton) inlineButton.view;
nsSaveButton.setBezelStyle(15); // NSBezelStyleInline is enum 15 for cocoa
this.inlineButton.setText("Inline Button");
结果:
(截自我的 java 程序)
我也尝试过重新绘制和重新布局 shell 以及其他各种方法,但均无济于事。
这是一个错误还是我做错了什么?
已解决。我只需要添加 "FLAT"
的 SWT 样式
this.inlineButton = new Button(this, SWT.FLAT);
NSButton inlineButton = (NSButton) inlineButton.view;
inlineButton.setBezelStyle(15);
我正在创建一个 SWT(已移植 Mac OSX 版本)应用程序。我正在尝试将特定按钮设置为具有 "inline" 的边框样式。这是我希望我的按钮在 mac 上的样子。
我用来尝试获取此内联按钮的代码:
// created button named "inlineButton" and applied layout to it.
// here is where I set the bezel style and text.
NSButton nsInlineButton = (NSButton) inlineButton.view;
nsSaveButton.setBezelStyle(15); // NSBezelStyleInline is enum 15 for cocoa
this.inlineButton.setText("Inline Button");
结果:
我也尝试过重新绘制和重新布局 shell 以及其他各种方法,但均无济于事。 这是一个错误还是我做错了什么?
已解决。我只需要添加 "FLAT"
的 SWT 样式this.inlineButton = new Button(this, SWT.FLAT);
NSButton inlineButton = (NSButton) inlineButton.view;
inlineButton.setBezelStyle(15);