# WidgetStyleHandler

Import: `import com.install4j.api.formcomponents.WidgetStyleHandler;`

```java
interface WidgetStyleHandler
```

With the widget style handler, you can apply a widget style to certain Swing components.
This is only required if you create buttons in a custom form component or custom screen.

All methods take a widget style ID. You can pass the empty string for the widget style that has been selected for the current screen style.
If you want the user to select a widget style, you can add a property of type `String` to your bean with a context of
[`CONTEXT_WIDGET_STYLE_ID`](../beaninfo/Install4JPropertyDescriptor.md#context-widget-style-id).
The user can also select the inherited style, in which case the property will contain the empty string.


**See also:**

- [FormEnvironment.getWidgetStyleHandler](FormEnvironment.md#getwidgetstylehandler)

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a button. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a text component. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a spinner. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a combo box. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a label. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a toggle button. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a list. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a tree. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a slider. |
| [`applyWidgetStyle(T, String)`](#applywidgetstyle-t-string) | `T` | Apply a widget style to a progress bar. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a button. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a text component. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a spinner. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a combo box. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a label. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a toggle button. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a list. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a tree. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a slider. |
| [`applyWidgetStyle(T)`](#applywidgetstyle-t) | `T` | Apply the default widget style to a progress bar. |

### applyWidgetStyle(T, String)

```java
<T extends JButton> T applyWidgetStyle(T button, String widgetStyleId)
```

Apply a widget style to a button.


**Parameters:**

- `button` — the button
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the button, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JTextComponent> T applyWidgetStyle(T textComponent, String widgetStyleId)
```

Apply a widget style to a text component.


**Parameters:**

- `textComponent` — the text component
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the text component, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JSpinner> T applyWidgetStyle(T spinner, String widgetStyleId)
```

Apply a widget style to a spinner.


**Parameters:**

- `spinner` — the spinner
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the spinner, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JComboBox> T applyWidgetStyle(T comboBox, String widgetStyleId)
```

Apply a widget style to a combo box.


**Parameters:**

- `comboBox` — the combo box
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the combo box, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JLabel> T applyWidgetStyle(T label, String widgetStyleId)
```

Apply a widget style to a label.


**Parameters:**

- `label` — the label
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the label, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JToggleButton> T applyWidgetStyle(T toggleButton, String widgetStyleId)
```

Apply a widget style to a toggle button.


**Parameters:**

- `toggleButton` — the toggle button
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the toggle button, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JList> T applyWidgetStyle(T list, String widgetStyleId)
```

Apply a widget style to a list.


**Parameters:**

- `list` — the list
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the list, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JTree> T applyWidgetStyle(T tree, String widgetStyleId)
```

Apply a widget style to a tree.


**Parameters:**

- `tree` — the tree
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the tree, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JSlider> T applyWidgetStyle(T slider, String widgetStyleId)
```

Apply a widget style to a slider.


**Parameters:**

- `slider` — the slider
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the slider, for fluent invocations

### applyWidgetStyle(T, String)

```java
<T extends JProgressBar> T applyWidgetStyle(T progressBar, String widgetStyleId)
```

Apply a widget style to a progress bar.


**Parameters:**

- `progressBar` — the progress bar
- `widgetStyleId` — the widget style ID. Pass the empty string for the default widget style of the current screen style.

**Returns:** the progress bar, for fluent invocations

### applyWidgetStyle(T)

```java
default <T extends JButton> T applyWidgetStyle(T button)
```

Apply the default widget style to a button.


**Parameters:**

- `button` — the button

**Returns:** the button, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jbutton-string)

### applyWidgetStyle(T)

```java
default <T extends JTextComponent> T applyWidgetStyle(T textComponent)
```

Apply the default widget style to a text component.


**Parameters:**

- `textComponent` — the text component

**Returns:** the text component, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jtextcomponent-string)

### applyWidgetStyle(T)

```java
default <T extends JSpinner> T applyWidgetStyle(T spinner)
```

Apply the default widget style to a spinner.


**Parameters:**

- `spinner` — the spinner

**Returns:** the spinner, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jspinner-string)

### applyWidgetStyle(T)

```java
default <T extends JComboBox> T applyWidgetStyle(T comboBox)
```

Apply the default widget style to a combo box.


**Parameters:**

- `comboBox` — the combo box

**Returns:** the combo box, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jcombobox-string)

### applyWidgetStyle(T)

```java
default <T extends JLabel> T applyWidgetStyle(T label)
```

Apply the default widget style to a label.


**Parameters:**

- `label` — the label

**Returns:** the label, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jlabel-string)

### applyWidgetStyle(T)

```java
default <T extends JToggleButton> T applyWidgetStyle(T toggleButton)
```

Apply the default widget style to a toggle button.


**Parameters:**

- `toggleButton` — the toggle button

**Returns:** the toggle button, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jtogglebutton-string)

### applyWidgetStyle(T)

```java
default <T extends JList> T applyWidgetStyle(T list)
```

Apply the default widget style to a list.


**Parameters:**

- `list` — the list

**Returns:** the list, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jlist-string)

### applyWidgetStyle(T)

```java
default <T extends JTree> T applyWidgetStyle(T tree)
```

Apply the default widget style to a tree.


**Parameters:**

- `tree` — the tree

**Returns:** the tree, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jtree-string)

### applyWidgetStyle(T)

```java
default <T extends JSlider> T applyWidgetStyle(T slider)
```

Apply the default widget style to a slider.


**Parameters:**

- `slider` — the slider

**Returns:** the slider, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jslider-string)

### applyWidgetStyle(T)

```java
default <T extends JProgressBar> T applyWidgetStyle(T progressBar)
```

Apply the default widget style to a progress bar.


**Parameters:**

- `progressBar` — the progress bar

**Returns:** the progress bar, for fluent invocations

**See also:**

- [WidgetStyleHandler.applyWidgetStyle](WidgetStyleHandler.md#applywidgetstyle-jprogressbar-string)

