# CheckBoxWidgetHelper.CheckBoxBuilder

`com.jsmacrosce.jsmacros.client.api.helper.screen.CheckBoxWidgetHelper.CheckBoxBuilder`

**Since:** 1.8.4

Builder for a checkbox widget; its checked setting determines the widget's initial state.

Nested type declared in [CheckBoxWidgetHelper](CheckBoxWidgetHelper.md).

## Constructors

### new CheckBoxWidgetHelper.CheckBoxBuilder {#com.jsmacrosce.jsmacros.client.api.helper.screen.CheckBoxWidgetHelper.CheckBoxBuilder_constructor-IScreen-}

```js
new CheckBoxWidgetHelper.CheckBoxBuilder(IScreen screen)
```

Associates this builder with the screen to which `build()` adds the widget.

**Parameters:**
- `screen`: the screen used by `build()` to add the widget

## Methods

### action {#com.jsmacrosce.jsmacros.client.api.helper.screen.CheckBoxWidgetHelper.CheckBoxBuilder_action-MethodWrapper-}

```js
action(MethodWrapper<CheckBoxWidgetHelper, IScreen, Object, ?> action): CheckBoxWidgetHelper.CheckBoxBuilder
```

**Parameters:**
- `action`: callback invoked when the checkbox state changes; `null` disables it

**Returns:** self for chaining.

**Since:** 1.8.4

### checked {#com.jsmacrosce.jsmacros.client.api.helper.screen.CheckBoxWidgetHelper.CheckBoxBuilder_checked-boolean-}

```js
checked(boolean checked): CheckBoxWidgetHelper.CheckBoxBuilder
```

Sets the checkbox's initial checked state; it does not constrain later changes.

**Parameters:**
- `checked`: whether the checkbox is initially checked or not

**Returns:** self for chaining.

**Since:** 1.8.4

### createWidget {#com.jsmacrosce.jsmacros.client.api.helper.screen.CheckBoxWidgetHelper.CheckBoxBuilder_createWidget-}

```js
createWidget(): CheckBoxWidgetHelper
```

Creates a checkbox from the configured label, position, checked state, dimensions,  
and z-index, and connects its value-change callback. The callback forwards the
helper and associated screen to the configured action, logging caught exceptions.  
This does not add the widget to the screen or apply `build()`'s alpha, active,  
and visible flags.

**Returns:** a helper for the newly created checkbox

### getAction {#com.jsmacrosce.jsmacros.client.api.helper.screen.CheckBoxWidgetHelper.CheckBoxBuilder_getAction-}

```js
getAction(): MethodWrapper<CheckBoxWidgetHelper, IScreen, Object, ?>
```

**Returns:** the configured change callback, or `null` if none is set.

**Since:** 1.8.4

### isChecked {#com.jsmacrosce.jsmacros.client.api.helper.screen.CheckBoxWidgetHelper.CheckBoxBuilder_isChecked-}

```js
isChecked(): boolean
```

Returns whether this builder will create the checkbox initially checked.

**Returns:** `true` if the checkbox is initially checked, `false` otherwise.

**Since:** 1.8.4
