# ListHandle

Import: `import com.install4j.api.test.formcomponents.ListHandle;`

```java
interface ListHandle extends FormComponentHandle
```

Handle for the "List" form component. The Swing widget is a `JList`.

Reach this handle via [`ScreenHandle.list`](../ui/ScreenHandle.md#list).

## Inherited from

- [FormComponentHandle](FormComponentHandle.md) — 7 methods

## Methods

| Signature | Returns | Description |
|---|---|---|
| [`getItems()`](#getitems) | `List<String>` | The items currently in the list. |
| [`getSelectedItem()`](#getselecteditem) | `String` | The single selected item, or empty if nothing is selected. |
| [`getSelectedItems()`](#getselecteditems) | `List<String>` | The currently selected items. |
| [`selectItem(String)`](#selectitem-string) | `ListHandle` | Select the first item whose label equals the given value. |
| [`selectIndex(int)`](#selectindex-int) | `ListHandle` | Select the item at the given index. |
| [`assertSelectedItem(String)`](#assertselecteditem-string) | `ListHandle` | Assert that the currently selected item equals the expected value. |
| [`assertEnabled()`](#assertenabled) | `ListHandle` |  |
| [`assertDisabled()`](#assertdisabled) | `ListHandle` |  |
| [`assertVisible()`](#assertvisible) | `ListHandle` |  |
| [`assertInvisible()`](#assertinvisible) | `ListHandle` |  |

### getItems()

```java
List<String> getItems()
```

The items currently in the list.

### getSelectedItem()

```java
String getSelectedItem()
```

The single selected item, or empty if nothing is selected. Multi-selection is exposed via
[`ListHandle.getSelectedItems`](ListHandle.md#getselecteditems).

### getSelectedItems()

```java
List<String> getSelectedItems()
```

The currently selected items.

### selectItem(String)

```java
ListHandle selectItem(String item)
```

Select the first item whose label equals the given value.

### selectIndex(int)

```java
ListHandle selectIndex(int index)
```

Select the item at the given index.

### assertSelectedItem(String)

```java
ListHandle assertSelectedItem(String expected)
```

Assert that the currently selected item equals the expected value.

### assertEnabled()

```java
ListHandle assertEnabled()
```

### assertDisabled()

```java
ListHandle assertDisabled()
```

### assertVisible()

```java
ListHandle assertVisible()
```

### assertInvisible()

```java
ListHandle assertInvisible()
```

