我有一个使用ToolBarManager的应用程序,我需要更改按钮的字体颜色。
ICoolBarManager coolBar = ...
IToolBarManager toolBar = new ToolBarManager(coolBar.getStyle());
MyAction myAction = new MyAction();
myAction.setText("I need this text in other color"); //this is my button's description at the toolbar
toolBar.add(myAction);
coolBar.add(new ToolBarContributionItem(toolBar, "msg"));
我找不到setStyle或setFont或其他方法。
如何更改工具栏按钮中的文本颜色?
ToolBarManager
有一个getControl()
返回您基础SWTToolBar
控件的方法(请注意,此方法仅在接口中ToolBarManager
不存在IToolBarManager
)。
ToolBar
有通常SWT setForeground
,setBackground
,setFont
方法。
注意:根据的ToolBarManager
构造方式,ToolBar
可能要等到ToolBarManager.createControl
被调用后才能创建。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句