- /**
- * Marks as selected the colour menu item matching the given name, or the
- * first item ('None') if no match is found
- *
- * @param colourName
- */
- protected void setColourSelected(String colourName)
- {
- noColourmenuItem.setSelected(true);
- if (colourName == null)
- {
- return;
- }
-
- /*
- * look for a radio button with a name that matches the colour name
- * (note the button text may not as it may be internationalised)
- */
- for (Component menuItem : colourMenu.getMenuComponents())
- {
- if (menuItem instanceof JRadioButtonMenuItem)
- {
- if (colourName.equals(((JRadioButtonMenuItem) menuItem).getName()))
- {
- ((JRadioButtonMenuItem) menuItem).setSelected(true);
- return;
- }
- }
- }
- }
-