I have an application using a ToolBarManager and I need to change the font color of a button.
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"));
I can't find a way to setStyle or setFont or something else.
How can I change the text color in a toolbar button?
ToolBarManager
has a getControl()
method which returns you the underlying SWT ToolBar
control (note this method is only in ToolBarManager
not the IToolBarManager
interface).
ToolBar
has the usual SWT setForeground
, setBackground
, setFont
methods.
Note: depending on how the ToolBarManager
is constructed the ToolBar
may not be created until ToolBarManager.createControl
is called.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.