Java SWT: How to indicate a menu item is selected

javamenuswt

Using SWT, what is the common way to indicate that a menu item (from a taskbar menu) is the currently active selection? Checkmark? Bold? How is this done with code?

Best Solution

Use the CHECK style during instantiation:

MenuItem menuItem = new MenuItem(menu, SWT.CHECK);

Use getSelection to check status:

boolean isSelected = menuItem.getSelection();