# AlertHandle

Import: `import com.install4j.api.test.ui.AlertHandle;`

```java
interface AlertHandle extends DialogHandle
```

A `JOptionPane`-built modal alert. Carries an icon type for info, warning, error or
question, and exposes OK / Cancel / Yes / No clicks.

Reach this handle via [`Session.alert`](../session/Session.md#alert).

| Type | Kind | Description |
|---|---|---|
## Nested types

| [AlertHandle.IconType](AlertHandle.IconType.md) | enum | The icon shown by the alert, matching `javax.swing.JOptionPane`'s message-type constants. |

## Inherited from

- [DialogHandle](DialogHandle.md) — 2 methods
- [UiContainer](UiContainer.md) — 2 methods

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getMessageText()`](#getmessagetext) | `String` | The alert's message text. |
| [`getIconType()`](#geticontype) | `IconType` | The configured icon type. |
| [`clickOk()`](#clickok) | `void` | Click a button labeled or named "OK". |
| [`clickCancel()`](#clickcancel) | `void` | Click a button labeled or named "Cancel". |
| [`clickYes()`](#clickyes) | `void` | Click a button labeled or named "Yes". |
| [`clickNo()`](#clickno) | `void` | Click a button labeled or named "No". |

### getMessageText()

```java
String getMessageText()
```

The alert's message text.

### getIconType()

```java
IconType getIconType()
```

The configured icon type.

### clickOk()

```java
void clickOk()
```

Click a button labeled or named "OK".

### clickCancel()

```java
void clickCancel()
```

Click a button labeled or named "Cancel".

### clickYes()

```java
void clickYes()
```

Click a button labeled or named "Yes".

### clickNo()

```java
void clickNo()
```

Click a button labeled or named "No".

