# ButtonWidgetHelper.TexturedButtonBuilder

`com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder`

**Since:** 1.8.4

Builds a texture-based button bound to the screen that supplied this builder.  
 Provide textures for the enabled, disabled, enabled-focused, and disabled-focused
 states; none falls back to another. Its height is fixed at 20.  
 ```js
const screen = Hud.createScreen("a screen", true);  
screen.setOnInit(JavaWrapper.methodToJava(function (self) {
  self.texturedButtonBuilder()
     .pos(10, 20)
     .size(100, 20)
     .enabledTexture("minecraft:item/diamond")
     .disabledTexture("minecraft:item/emerald")
     .enabledFocusedTexture("minecraft:item/diamond")
     .disabledFocusedTexture("minecraft:item/emerald")
     .build();  
}));  
Hud.openScreen(screen);  
 ```

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

## Constructors

### new ButtonWidgetHelper.TexturedButtonBuilder {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_constructor-IScreen-}

```js
new ButtonWidgetHelper.TexturedButtonBuilder(IScreen screen)
```

Retains the screen associated with this builder for later widget creation.

**Parameters:**
- `screen`: screen associated with the builder

## Methods

### action {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_action-MethodWrapper-}

```js
action(MethodWrapper<ButtonWidgetHelper<ImageButton>, IScreen, Object, ?> action): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the action run when the button is activated; pass `null` to clear it.

**Parameters:**
- `action`: the action to run, or `null` for no action

**Returns:** this builder

**Since:** 1.8.4

### createWidget {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_createWidget-}

```js
createWidget(): ButtonWidgetHelper<ImageButton>
```

Creates and wraps a new texture-based button from this builder's current configuration without adding it to the screen or applying shared post-creation styles. Use `build()` to create, configure, and add the button.

**Returns:** the newly wrapped texture-based button

### disabledFocusedTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_disabledFocusedTexture-Identifier-}

```js
disabledFocusedTexture(Identifier disabledFocused): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the texture used when the button is inactive and hovered or focused.

**Parameters:**
- `disabledFocused`: the texture to draw while disabled and focused

**Returns:** this builder

**Since:** 1.9.0

### disabledFocusedTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_disabledFocusedTexture-String-}

```js
disabledFocusedTexture(String disabledFocused): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the disabled, focused texture from its resource-location string; an omitted namespace defaults to `minecraft`.

**Parameters:**
- `disabledFocused`: the texture to draw while disabled and focused

**Returns:** this builder

**Since:** 1.9.3

### disabledTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_disabledTexture-Identifier-}

```js
disabledTexture(Identifier disabled): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the texture used when the button is inactive and neither hovered nor focused.

**Parameters:**
- `disabled`: the texture to draw while disabled

**Returns:** this builder

**Since:** 1.9.0

### disabledTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_disabledTexture-String-}

```js
disabledTexture(String disabled): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the disabled, unfocused texture from its resource-location string; an omitted namespace defaults to `minecraft`.

**Parameters:**
- `disabled`: the texture to draw while disabled

**Returns:** this builder

**Since:** 1.9.3

### enabledFocusedTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_enabledFocusedTexture-Identifier-}

```js
enabledFocusedTexture(Identifier enabledFocused): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the texture used when the button is active and hovered or focused.

**Parameters:**
- `enabledFocused`: the texture to draw while enabled and focused

**Returns:** this builder

**Since:** 1.9.0

### enabledFocusedTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_enabledFocusedTexture-String-}

```js
enabledFocusedTexture(String enabledFocused): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the enabled, focused texture from its resource-location string; an omitted namespace defaults to `minecraft`.

**Parameters:**
- `enabledFocused`: the texture to draw while enabled and focused

**Returns:** this builder

**Since:** 1.9.3

### enabledTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_enabledTexture-Identifier-}

```js
enabledTexture(Identifier enabled): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the texture used when the button is active and neither hovered nor focused.

**Parameters:**
- `enabled`: the texture to draw while enabled and not focused

**Returns:** this builder

**Since:** 1.9.0

### enabledTexture {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_enabledTexture-String-}

```js
enabledTexture(String enabled): ButtonWidgetHelper.TexturedButtonBuilder
```

Sets the enabled, unfocused texture from its resource-location string; an omitted namespace defaults to `minecraft`.

**Parameters:**
- `enabled`: the texture to draw while enabled and not focused

**Returns:** this builder

**Since:** 1.9.3

### getAction {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_getAction-}

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

**Returns:** the configured action, or `null` if none is set

**Since:** 1.8.4

### height {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_height-int-}

```js
height(int height): ButtonWidgetHelper.TexturedButtonBuilder
```

**Parameters:**
- `height`: ignored; the button height remains 20

**Returns:** this builder

**Since:** 1.8.4

### size {#com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder_size-int-int-}

```js
size(int width, int height): ButtonWidgetHelper.TexturedButtonBuilder
```

**Parameters:**
- `width`: the button width
- `height`: ignored; the button height remains 20

**Returns:** this builder

**Since:** 1.8.4
