Creates a Binding instance. When you create a binding, you provide a key name, a UI control,
a game component, and an array of numbers. The array of numbers is a list of card faces
(0 for front, 1 for back, and so on) that need to be updated when the bound state changes. For
example, if the bound state represented content that is drawn only on the component's back face,
then you would use [1]
.
the setting key that the control is bound to; if it starts with $
,
the $
will be removed and any underscores (_
) replaced with dashes (-
)
the UI component that will take part in the binding
the game component that will take part in the binding
an array of the indices of the game component's sheets which should be repainted when the bound setting changes
Converts the state of the control to a setting string. Subclasses override this to customize how the control's state is represented in the game component's private settings.
the control whose state should be converted to a string
the string representing the state of the control
Updates the UI component using the current setting value.
Called to installs the mechanism which makes the binding active
(such as an event listener) on this.control
.
The base class attempts to install an ActionListener
on the component,
which is sufficient for many types on control.
Changes the state of the control
to reflect the provided
setting value.
Subclasses override this to customize how the control's state is
represented in the game component's private settings.
the string value to be mapped to a control state
the control to update
Updates the UI component setting using the current value of the control.
true if the setting has changed
Binds a
swing.JCheckBox
to a setting that can be fetched withgameComponent.settings.getYesNo(keyName)
.