Package ca.corbett.forms.fields
Class CheckBoxField
java.lang.Object
ca.corbett.forms.fields.FormField
ca.corbett.forms.fields.CheckBoxField
A FormField to wrap a JCheckBox.
A note about validation: checkboxes don't generally "count" when a FormPanel validates itself. That is, they won't show a validation label to indicate that the selected value is "correct". You can change this behavior by using addFieldValidator() - if any FieldValidators are present on this field, then it will be included when the FormPanel is validated.
Getting access to the underlying JCheckBox - if you need access to the underlying JCheckBox (for example, for styling purposes, changing the font, etc), you can use getFieldComponent() and cast the return to JCheckBox.
- Since:
- 2019-11-27
- Author:
- scorbo2
-
Field Summary
Fields inherited from class ca.corbett.forms.fields.FormField
DEFAULT_FONT, defaultFont, extraAttributes, fieldComponent, fieldLabel, fieldValidators, helpLabel, identifier, isEnabled, isVisible, margins, validationLabel, valueChangedListeners -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanOverridden here as we generally don't want to show a validation label on a checkbox.booleansetChecked(boolean checked) Methods inherited from class ca.corbett.forms.fields.FormField
addAllExtraAttributes, addFieldValidator, addValueChangedListener, clearExtraAttribute, clearExtraAttributes, clearValidationResults, equals, fireValueChangedEvent, getDefaultFont, getExtraAttribute, getFieldComponent, getFieldLabel, getHelpLabel, getHelpText, getIdentifier, getMargins, getValidationLabel, hasFieldLabel, hashCode, hasHelpLabel, isEnabled, isMultiLine, isValid, isVisible, preRender, removeAllFieldValidators, removeFieldValidator, removeValueChangedListener, setAllExtraAttributes, setDefaultFont, setEnabled, setExtraAttribute, setFieldLabelFont, setHelpText, setIdentifier, setMargins, setVisible, shouldExpand, validate
-
Constructor Details
-
CheckBoxField
-
-
Method Details
-
hasValidationLabel
public boolean hasValidationLabel()Overridden here as we generally don't want to show a validation label on a checkbox. Will return true only if one or more FieldValidators have been explicitly assigned.- Overrides:
hasValidationLabelin classFormField
-
isChecked
public boolean isChecked() -
setChecked
-