Class CheckBoxOption
java.lang.Object
com.realtime.crossfire.jxclient.settings.options.Option
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption
- Direct Known Subclasses:
CommandCheckBoxOption,PickupOption,ShowSentCommandsCheckBoxOption,ShowTimestampMessagesCheckBoxOption,SoundEffectsCheckBoxOption,SoundMusicCheckBoxOption,TranslucentDialogsCheckBoxOption
The base class for all check box options. It manages the checked/unchecked
state and notifies listeners about changes.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCheckBoxOption(@NotNull String tooltipText) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidexecute(boolean checked) Executes the action associated with this check box option.protected voidNotifies all listeners that the state has changed.@NotNull StringReturns the tooltip text to explain this option.booleanReturns the current state.abstract booleanReturns the default value ofisChecked().voidsetChecked(boolean checked) Sets the current state.voidToggles the checked state.Methods inherited from class com.realtime.crossfire.jxclient.settings.options.Option
addOptionListener, inhibitSave, removeOptionListener
-
Constructor Details
-
CheckBoxOption
Creates a new instance.- Parameters:
tooltipText- the tooltip text to explain this option
-
-
Method Details
-
isChecked
public boolean isChecked()Returns the current state.- Returns:
- the current state
-
setChecked
public void setChecked(boolean checked) Sets the current state.- Parameters:
checked- the new state
-
toggleChecked
public void toggleChecked()Toggles the checked state. -
execute
protected abstract void execute(boolean checked) Executes the action associated with this check box option. Must be implemented in subclasses.- Parameters:
checked- whether the checkbox option is checked
-
fireStateChangedEvent
protected void fireStateChangedEvent()Description copied from class:OptionNotifies all listeners that the state has changed.- Overrides:
fireStateChangedEventin classOption
-
isDefaultChecked
public abstract boolean isDefaultChecked()Returns the default value ofisChecked().- Returns:
- the default value
-
getTooltipText
Returns the tooltip text to explain this option.- Returns:
- the tooltip text
-