# WizardContext

Import: `import com.install4j.api.context.WizardContext;`

```java
interface WizardContext
```

The wizard context allows you to modify the GUI installer or uninstaller. It is returned by
[`Context.getWizardContext`](Context.md#getwizardcontext) and is only functional if the installer or uninstaller
is running in GUI mode.


**See also:**

- [Context.getWizardContext](Context.md#getwizardcontext)

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`setControlButtonEnabled(ControlButtonType, boolean)`](#setcontrolbuttonenabled-controlbuttontype-boolean) | `void` | Change the enabled status of control buttons on the current screen. |
| [`setControlButtonVisible(ControlButtonType, boolean)`](#setcontrolbuttonvisible-controlbuttontype-boolean) | `void` | Change the visibility of control buttons on the current screen. |
| [`pressControlButton(ControlButtonType)`](#presscontrolbutton-controlbuttontype) | `void` | Perform the action associated with a particular control button. |
| [`focusControlButton(ControlButtonType)`](#focuscontrolbutton-controlbuttontype) | `void` | Transfer the focus to a particular control button. |
| [`setControlButtonText(ControlButtonType, String)`](#setcontrolbuttontext-controlbuttontype-string) | `void` | Set the test of control buttons on the current screen. |
| [`setNextButtonEnabled(boolean)`](#setnextbuttonenabled-boolean) | `void` | Change the enabled status of the "Next" button at the bottom of the current screen. |
| [`setBackButtonEnabled(boolean)`](#setbackbuttonenabled-boolean) | `void` | Change the enabled status of the "Back" button at the bottom of the current screen. |
| [`setCancelButtonEnabled(boolean)`](#setcancelbuttonenabled-boolean) | `void` | Change the enabled status of the "Cancel" button at the bottom of the current screen. |
| [`setNextButtonVisible(boolean)`](#setnextbuttonvisible-boolean) | `void` | Change the visibility of the "Next" button at the bottom of the current screen. |
| [`setBackButtonVisible(boolean)`](#setbackbuttonvisible-boolean) | `void` | Change the visibility of the "Back" button at the bottom of the current screen. |
| [`setCancelButtonVisible(boolean)`](#setcancelbuttonvisible-boolean) | `void` | Change the visibility of the "Cancel" button at the bottom of the current screen. |
| [`pressNextButton()`](#pressnextbutton) | `void` | Move to the next screen. |
| [`pressPreviousButton()`](#presspreviousbutton) | `void` | Move to the previous screen. |
| [`pressCancelButton()`](#presscancelbutton) | `void` | Cancel the installer or uninstaller. |
| [`focusNextButton()`](#focusnextbutton) | `void` | Transfer the focus to the Next button. |
| [`setNextButtonText(String)`](#setnextbuttontext-string) | `void` | Set the text on the "Next" button. |
| [`setPreviousButtonText(String)`](#setpreviousbuttontext-string) | `void` | Set the text on the "Previous" button. |
| [`setCancelButtonText(String)`](#setcancelbuttontext-string) | `void` | Set the text on the "Cancel" button. |
| [`setWizardIndex(WizardIndex)`](#setwizardindex-wizardindex) | `void` | Install a wizard index on the left side of the window to show overall installation progress. |
| [`setWizardIndexKey(String)`](#setwizardindexkey-string) | `void` | Change the highlighted step in the currently installed wizard index. |
| [`getStyleManager()`](#getstylemanager) | `StyleManager` | Get the screen style manager. |
| [`setWindowSize(int, int)`](#setwindowsize-int-int) | `void` | Sets the size of the application window. |
| [`setWindowTitle(String)`](#setwindowtitle-string) | `void` | Sets the title of the application window. |

### setControlButtonEnabled(ControlButtonType, boolean)

```java
void setControlButtonEnabled(ControlButtonType controlButtonType, boolean enabled)
```

Change the enabled status of control buttons on the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `controlButtonType` — the type of the control buttons
- `enabled` — if the buttons should be enabled or not

### setControlButtonVisible(ControlButtonType, boolean)

```java
void setControlButtonVisible(ControlButtonType controlButtonType, boolean visible)
```

Change the visibility of control buttons on the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `controlButtonType` — the type of the control buttons
- `visible` — if the buttons should be visible or not

### pressControlButton(ControlButtonType)

```java
void pressControlButton(ControlButtonType controlButtonType)
```

Perform the action associated with a particular control button.


**Parameters:**

- `controlButtonType` — the type of the control button

### focusControlButton(ControlButtonType)

```java
void focusControlButton(ControlButtonType controlButtonType)
```

Transfer the focus to a particular control button.
If there are multiple control buttons of the specified type, the first one will be used.


**Parameters:**

- `controlButtonType` — the type of the control button

### setControlButtonText(ControlButtonType, String)

```java
void setControlButtonText(ControlButtonType controlButtonType, String text)
```

Set the test of control buttons on the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `controlButtonType` — the type of the control buttons
- `text` — the new text

### setNextButtonEnabled(boolean)

```java
@Deprecated void setNextButtonEnabled(boolean enabled)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonEnabled`](WizardContext.md#setcontrolbuttonenabled-controlbuttontype-boolean) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

Change the enabled status of the "Next" button at the bottom of the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `enabled` — if the button should be enabled or not

**Deprecated.** use [`WizardContext.setControlButtonEnabled`](WizardContext.md#setcontrolbuttonenabled-controlbuttontype-boolean) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

### setBackButtonEnabled(boolean)

```java
@Deprecated void setBackButtonEnabled(boolean enabled)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonEnabled`](WizardContext.md#setcontrolbuttonenabled-controlbuttontype-boolean) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

Change the enabled status of the "Back" button at the bottom of the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `enabled` — if the button should be enabled or not

**Deprecated.** use [`WizardContext.setControlButtonEnabled`](WizardContext.md#setcontrolbuttonenabled-controlbuttontype-boolean) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

### setCancelButtonEnabled(boolean)

```java
@Deprecated void setCancelButtonEnabled(boolean enabled)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonEnabled`](WizardContext.md#setcontrolbuttonenabled-controlbuttontype-boolean) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

Change the enabled status of the "Cancel" button at the bottom of the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `enabled` — if the button should be enabled or not

**Deprecated.** use [`WizardContext.setControlButtonEnabled`](WizardContext.md#setcontrolbuttonenabled-controlbuttontype-boolean) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

### setNextButtonVisible(boolean)

```java
@Deprecated void setNextButtonVisible(boolean visible)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonVisible`](WizardContext.md#setcontrolbuttonvisible-controlbuttontype-boolean) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

Change the visibility of the "Next" button at the bottom of the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `visible` — if the button should be visible or not

**Deprecated.** use [`WizardContext.setControlButtonVisible`](WizardContext.md#setcontrolbuttonvisible-controlbuttontype-boolean) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

### setBackButtonVisible(boolean)

```java
@Deprecated void setBackButtonVisible(boolean visible)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonVisible`](WizardContext.md#setcontrolbuttonvisible-controlbuttontype-boolean) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

Change the visibility of the "Back" button at the bottom of the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `visible` — if the button should be visible or not

**Deprecated.** use [`WizardContext.setControlButtonVisible`](WizardContext.md#setcontrolbuttonvisible-controlbuttontype-boolean) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

### setCancelButtonVisible(boolean)

```java
@Deprecated void setCancelButtonVisible(boolean visible)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonVisible`](WizardContext.md#setcontrolbuttonvisible-controlbuttontype-boolean) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

Change the visibility of the "Cancel" button at the bottom of the current screen.
This setting applies only to the currently displayed screen.


**Parameters:**

- `visible` — if the button should be visible or not

**Deprecated.** use [`WizardContext.setControlButtonVisible`](WizardContext.md#setcontrolbuttonvisible-controlbuttontype-boolean) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

### pressNextButton()

```java
@Deprecated void pressNextButton()
```

> **⚠ Deprecated.** use [`WizardContext.pressControlButton`](WizardContext.md#presscontrolbutton-controlbuttontype) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

Move to the next screen. This has the same effect as if the user clicks on the Next button.


**Deprecated.** use [`WizardContext.pressControlButton`](WizardContext.md#presscontrolbutton-controlbuttontype) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

### pressPreviousButton()

```java
@Deprecated void pressPreviousButton()
```

> **⚠ Deprecated.** use [`WizardContext.pressControlButton`](WizardContext.md#presscontrolbutton-controlbuttontype) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

Move to the previous screen. This has the same effect as if the user clicks on the Back button.


**Deprecated.** use [`WizardContext.pressControlButton`](WizardContext.md#presscontrolbutton-controlbuttontype) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

### pressCancelButton()

```java
@Deprecated void pressCancelButton()
```

> **⚠ Deprecated.** use [`WizardContext.pressControlButton`](WizardContext.md#presscontrolbutton-controlbuttontype) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

Cancel the installer or uninstaller. This has the same effect as if the user clicks on the Cancel button.


**Deprecated.** use [`WizardContext.pressControlButton`](WizardContext.md#presscontrolbutton-controlbuttontype) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

### focusNextButton()

```java
@Deprecated void focusNextButton()
```

> **⚠ Deprecated.** use [`WizardContext.focusControlButton`](WizardContext.md#focuscontrolbutton-controlbuttontype) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

Transfer the focus to the Next button. This could be called in the "Post-activation" script of a screen.


**Deprecated.** use [`WizardContext.focusControlButton`](WizardContext.md#focuscontrolbutton-controlbuttontype) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

### setNextButtonText(String)

```java
@Deprecated void setNextButtonText(String text)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonText`](WizardContext.md#setcontrolbuttontext-controlbuttontype-string) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

Set the text on the "Next" button.


**Parameters:**

- `text` — the new text

**Deprecated.** use [`WizardContext.setControlButtonText`](WizardContext.md#setcontrolbuttontext-controlbuttontype-string) with [`ControlButtonType.NEXT`](ControlButtonType.md#next) instead

### setPreviousButtonText(String)

```java
@Deprecated void setPreviousButtonText(String text)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonText`](WizardContext.md#setcontrolbuttontext-controlbuttontype-string) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

Set the text on the "Previous" button.


**Parameters:**

- `text` — the new text

**Deprecated.** use [`WizardContext.setControlButtonText`](WizardContext.md#setcontrolbuttontext-controlbuttontype-string) with [`ControlButtonType.PREVIOUS`](ControlButtonType.md#previous) instead

### setCancelButtonText(String)

```java
@Deprecated void setCancelButtonText(String text)
```

> **⚠ Deprecated.** use [`WizardContext.setControlButtonText`](WizardContext.md#setcontrolbuttontext-controlbuttontype-string) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

Set the text on the "Cancel" button.


**Parameters:**

- `text` — the new text

**Deprecated.** use [`WizardContext.setControlButtonText`](WizardContext.md#setcontrolbuttontext-controlbuttontype-string) with [`ControlButtonType.CANCEL`](ControlButtonType.md#cancel) instead

### setWizardIndex(WizardIndex)

```java
void setWizardIndex(WizardIndex wizardIndex)
```

Install a wizard index on the left side of the window to show overall installation progress.
See [`WizardIndex`](WizardIndex.md) for more information. The first step in the wizard index will
be highlighted immediately. This setting is not restricted to the current screen, it remains active for subsequent screens.
It is suggested to increase the window width of your installer if you use wizard indices.


**Parameters:**

- `wizardIndex` — the new wizard index or `null` if the current wizard index should be removed.

### setWizardIndexKey(String)

```java
void setWizardIndexKey(String key)
```

Change the highlighted step in the currently installed wizard index.
If no wizard index is set, this has no effect.


**Parameters:**

- `key` — the index key of the step that should be highlighted. If the key cannot be found
in the current wizard index, no step will be highlighted.

### getStyleManager()

```java
StyleManager getStyleManager()
```

Get the screen style manager. This is useful if you need to nest screen styles or if you have to reference screen styles
from screens or form components.


**Returns:** the screen style manager

### setWindowSize(int, int)

```java
void setWindowSize(int width, int height)
```

Sets the size of the application window.
This can also be called before any window is shown.


**Parameters:**

- `width` — the width of the window
- `height` — the height of the window

### setWindowTitle(String)

```java
void setWindowTitle(String title)
```

Sets the title of the application window.
This can also be called before any window is shown.
For installer variables in the title, live binding will replace them whenever they change.


**Parameters:**

- `title` — the title

