简体   繁体   中英

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**
      }
}

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

item1.setForeground(Color.red);

你的意思是这个吗?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM