+ /**
+ * Sets the given action’s enabled state to the given enabled state if the
+ * action’s current enabled state is not the given enabled state.
+ *
+ * @param action
+ * The action to set the enabled state on
+ * @param enabled
+ * The new enabled state of the action
+ */
+ private void setEnabled(Action action, boolean enabled) {
+ if (action.isEnabled() != enabled) {
+ action.setEnabled(enabled);
+ }
+ }
+
+ /**
+ * Sets the given button’s selected state to the given selected state if the
+ * button’s current selected state is not the given selected state.
+ *
+ * @param button
+ * The button to set the selected state on
+ * @param selected
+ * The new selected state of the button
+ */
+ private void setSelected(AbstractButton button, boolean selected) {
+ if (button.isSelected() != selected) {
+ button.setSelected(selected);
+ }
+ }
+