# FilePicker

> Reserved — empty skeleton in the 2026 API (produces no result).

Source: https://crossfly.dev/docs/ui/widgets/filepicker — CrossFly documentation. Full docs as one file: https://crossfly.dev/llms-full.txt

# FilePicker

> 🔴 · **Package:** `dev.crossfly.ui.picker` · **Extends:** `Picker` · **Status: reserved (unavailable)**

`FilePicker` is **reserved** in the 2026 API: in the current code it is just an empty skeleton —

```java
public class FilePicker extends Picker {}
```

— with no constructors, fields, layout or its own `getAnswer()`. It **inherits `getAnswer()` from the base** ([`Picker`](/docs/ui/widgets/picker)), which returns `null`; therefore it **produces no result** and should not be used.

## Complete example (copy, paste and run)
`FilePicker` is **reserved** and produces no result (it inherits `getAnswer()` from the base, which returns `null`). The example below is executable and **honestly** demonstrates this limitation: it shows the picker, collects `getAnswer()` and reports that it came back `null`. To actually pick media, the adjacent button uses the available alternative, [`PhotoPicker`](/docs/ui/widgets/photopicker).

```java
package com.exemplo;

import dev.crossfly.ui.*;
import dev.crossfly.ui.layout.*;
import dev.crossfly.ui.picker.*;

/** Runnable main screen. Point the launcher (classname) and run: gradlew :lwjgl3:run */
public class MainWindow extends Window
{
   @Override
   public void onShow() throws Exception
   {
      super.onShow();
      setLayout(new VerticalLayout());

      Label saida = new Label("Resultado: —");
      add(LAY_AUTO, saida);

      // FilePicker is a reserved skeleton: getAnswer() always returns null.
      Button tentarFilePicker = new Button("Tentar FilePicker (reservado)")
         .onAction(c ->
         {
            FilePicker fp = new FilePicker();
            fp.show(answer ->
               saida.setText("FilePicker devolveu: " + answer + " (reservado, sem resultado)"));
         });
      add(LAY_AUTO, tentarFilePicker);

      // Real alternative to capture media: PhotoPicker.
      Button usarPhotoPicker = new Button("Alternativa: PhotoPicker")
         .onAction(c ->
         {
            PhotoPicker pp = new PhotoPicker(PhotoPicker.Preview.PHOTO);
            pp.show(answer ->
            {
               String caminho = (String) answer;
               if (pp.isError())
                  saida.setText("Erro de câmera: " + caminho);
               else
                  saida.setText("Foto salva em: " + caminho);
            });
         });
      add(LAY_AUTO, usarPhotoPicker);
   }
}
```

> The snippets below show **only the core** (what goes inside `onShow()`). To run them, place them in the `MainWindow` skeleton above.

## Intended purpose
Browse the file system and return the path of the selected file/folder. The comment in the source indicates the intention to migrate to a lazy tree-based selector from a root — but this **has not been ported yet**.

## What does NOT exist (do not document as available)
The previous implementation (lazy tree with `Tree`/`TreeModel`, image preview, volumes via `Dropdown`, multiple selection) **was removed**, consistent with the removal of the `ui/tree` module in the modernization. The old APIs — `Filter`, `initialPath`, `multipleSelection`, `mountTree`, `getTree`, etc. — **no longer exist**.

## Alternatives while it is reserved
- To capture media from the camera, use [`PhotoPicker`](/docs/ui/widgets/photopicker).
- To pick a color/date/time, use the specific pickers.
- Treat `FilePicker` as unavailable until the code is fleshed out.

## See also
- Area guide: [`ui/`](/docs/ui) · Recipes: [`cookbook/`](/docs/cookbook)
- Pattern base: [`Picker`](/docs/ui/widgets/picker)
