Class CheckBoxOption
- java.lang.Object
-
- com.realtime.crossfire.jxclient.settings.options.Option
-
- com.realtime.crossfire.jxclient.settings.options.CheckBoxOption
-
- Direct Known Subclasses:
CommandCheckBoxOption,PickupOption,SoundEffectsCheckBoxOption,SoundMusicCheckBoxOption
public abstract class CheckBoxOption extends Option
The base class for all check box options. It manages the checked/unchecked state and notifies listeners about changes.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCheckBoxOption(@NotNull java.lang.String tooltipText)Creates a new instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidexecute(boolean checked)Executes the action associated with this check box option.protected voidfireStateChangedEvent()Notifies all listeners that the state has changed.@NotNull java.lang.StringgetTooltipText()Returns the tooltip text to explain this option.booleanisChecked()Returns the current state.abstract booleanisDefaultChecked()Returns the default value ofisChecked().voidsetChecked(boolean checked)Sets the current state.voidtoggleChecked()Toggles the checked state.-
Methods inherited from class com.realtime.crossfire.jxclient.settings.options.Option
addOptionListener, inhibitSave, removeOptionListener
-
-
-
-
Method Detail
-
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 sub-classes.- Parameters:
checked- whether the check box 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
@NotNull public @NotNull java.lang.String getTooltipText()
Returns the tooltip text to explain this option.- Returns:
- the tooltip text
-
-