# PasswordDialogHandle

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

```java
interface PasswordDialogHandle extends DialogHandle
```

Typed handle for a password dialog.

The dialog has two modes: password-only and user-plus-password. The user methods only do
something useful in the latter case, since the user text field is not laid out otherwise.

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

## Inherited from

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

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`setUser(String)`](#setuser-string) | `PasswordDialogHandle` | Set the username. |
| [`getUser()`](#getuser) | `String` | The username currently typed in the user field. |
| [`setPassword(String)`](#setpassword-string) | `PasswordDialogHandle` | Set the password. |
| [`getPassword()`](#getpassword) | `String` | The plain-text password currently typed in the password field. |
| [`confirm()`](#confirm) | `void` | Confirm the dialog. |
| [`cancel()`](#cancel) | `void` | Cancel the dialog without submitting credentials. |

### setUser(String)

```java
PasswordDialogHandle setUser(String user)
```

Set the username. Only meaningful in user-plus-password mode.

### getUser()

```java
String getUser()
```

The username currently typed in the user field.

### setPassword(String)

```java
PasswordDialogHandle setPassword(String password)
```

Set the password.

### getPassword()

```java
String getPassword()
```

The plain-text password currently typed in the password field.

### confirm()

```java
void confirm()
```

Confirm the dialog. The runtime then runs whatever validator the caller configured and
either accepts the input or re-opens the dialog.

### cancel()

```java
void cancel()
```

Cancel the dialog without submitting credentials.

