Change eclipse menuitem color

不羁岁月 提交于 2019-12-11 06:36:47

问题


I would like to change some menuitems color ,for example yellow, dynamically with my plugin. is it possible?

More details:
Lets say I wanna change the file->import menuitem to yellow, which class is responsible for that?
For simpleness, if I got SWT window, calculater with File menu in it, how to change the File->exit menuItem to yellow when I press or do something in this calculator windows??
thanks in advance


回答1:


Any menu-related color settings are OS-dependent, since SWT is based on native GUI implementation (as Kos alludes to in the comment).

This thread asks for the "inactive color":

I don't think there's a SWT.COLOR_... available for disabled menu texts, it's the OSs that colors these texts.
I don't know if the OSs provide a way for accessing this color programmatically.

This thread want to add color to a popup menu, and the best solution is...

I think your best bet is #2, that way you could put (for instance) a Table widget with no columns in the pop-up, which would allow you customize the item appearances however you like.

  • emulated tooltip snippet (.java)
  • Table custom draw article



来源:https://stackoverflow.com/questions/4171576/change-eclipse-menuitem-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!