Selin
Selin

Reputation: 646

How to change text color on menu item

I'm using Java and SWT. I have added menu(on right click) to system tray. I want to change color of the text on menu items. Is it possible? I couldn't find any solution about this.

 TrayItem item = new TrayItem(tray, SWT.NONE);
 item.addListener(SWT.MenuDetect, new Listener() {
      public void handleEvent(org.eclipse.swt.widgets.Event event) {
           Menu menu = new Menu(shell, SWT.POP_UP);
           MenuItem item1 = new MenuItem(menu, SWT.NONE);
           item1.setText("Settings");   // **i want to change color of the text**
      }
}

Upvotes: 4

Views: 1874

Answers (2)

fj123
fj123

Reputation: 1013

item1.setForeground(Color.red);

u mean this one??

Upvotes: -1

Baz
Baz

Reputation: 36894

No, this is not possible yet. There is a bug report here.

Upvotes: 3

Related Questions