# UiUtil

Import: `import com.install4j.api.UiUtil;`

```java
public class UiUtil
```

This class contains methods that deal with global properties of the installer application GUI.

When running in console or unattended mode, these methods can still be called, although they may not have
any effect or return any helpful information.

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`isDarkDesktop()`](#isdarkdesktop) | `boolean` | Returns if the desktop environment is in dark mode or not. |
| [`isDarkUi()`](#isdarkui) | `boolean` | Returns if the installer application is running in dark mode or not. |
| [`setDarkUi(boolean)`](#setdarkui-boolean) | `void` | Switch between dark and light mode and update all windows with the new mode. |
| [`getLookAndFeelEnhancer()`](#getlookandfeelenhancer) | `LookAndFeelEnhancer` | Returns the currently active look and feel info. |
| [`getParentWindow()`](#getparentwindow) | `Window` | Get the topmost window in the current JVM. |
| [`getWizardWindow()`](#getwizardwindow) | `Window` | Get the current install4j wizard window. |

### isDarkDesktop()

```java
public static boolean isDarkDesktop()
```

Returns if the desktop environment is in dark mode or not.

To check whether the installer application is running with a dark look and feel, you should call
[`UiUtil.isDarkUi`](UiUtil.md#isdarkui)
instead. If you have selected the FlatLaf look and feel for installer applications with dark mode
auto-detection enabled, both methods will return the same value.

### isDarkUi()

```java
public static boolean isDarkUi()
```

Returns if the installer application is running in dark mode or not.

This is a convenience method for calling

```
  UiUtil.getLookAndFeelEnhancer().isDark()
```


**See also:**

- [LookAndFeelEnhancer.isDark](laf/LookAndFeelEnhancer.md#isdark)

### setDarkUi(boolean)

```java
public static void setDarkUi(boolean dark)
```

Switch between dark and light mode and update all windows with the new mode.

This will only have an effect if [`LookAndFeelEnhancer.isDarkModeSwitchingSupported`](laf/LookAndFeelEnhancer.md#isdarkmodeswitchingsupported)
returns `true` and if the installer application is running in GUI mode.


**Parameters:**

- `dark` — `true` for dark mode

### getLookAndFeelEnhancer()

```java
public static LookAndFeelEnhancer getLookAndFeelEnhancer()
```

Returns the currently active look and feel info.

### getParentWindow()

```java
public static Window getParentWindow()
```

Get the topmost window in the current JVM.


**Returns:** the window or `null` if the installer application is running in console mode or in
unattended mode without alerts.

### getWizardWindow()

```java
public static Window getWizardWindow()
```

Get the current install4j wizard window.


**Returns:** the window or `null` if the installer application is running in console mode or in
unattended mode without alerts.

## Constructors

| Signature | Description |
|---|---|
| [`UiUtil()`](#uiutil) |  |

### UiUtil()

```java
public UiUtil()
```

