How to change the color of text in a menu item

I use Java and SWT. I added a menu (right click) to the system tray. I want to change the color of the text in the menu items. Is it possible? I could not find a solution to 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** } } 
+4
source share
2 answers

No, this is not yet possible. There is an error report here .

+3
source
 item1.setForeground(Color.red); 

u mean this one?

-1
source

Source: https://habr.com/ru/post/1440239/


All Articles