Search in sources :

Example 1 with SingleFileChooserListener

use of com.kotcrab.vis.ui.widget.file.SingleFileChooserListener in project Mundus by jpooleycodes.

the class FileChooserField method setupListeners.

private void setupListeners() {
    fcBtn.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            FileChooser fileChooser = UI.INSTANCE.getFileChooser();
            fileChooser.setSelectionMode(mode);
            fileChooser.setListener(new SingleFileChooserListener() {

                @Override
                protected void selected(FileHandle file) {
                    fileHandle = file;
                    path = file.path();
                    textField.setText(file.path());
                    if (fileSelected != null) {
                        fileSelected.selected(file);
                    }
                }
            });
            UI.INSTANCE.addActor(fileChooser.fadeIn());
        }
    });
}
Also used : FileHandle(com.badlogic.gdx.files.FileHandle) FileChooser(com.kotcrab.vis.ui.widget.file.FileChooser) SingleFileChooserListener(com.kotcrab.vis.ui.widget.file.SingleFileChooserListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) ClickListener(com.badlogic.gdx.scenes.scene2d.utils.ClickListener)

Aggregations

FileHandle (com.badlogic.gdx.files.FileHandle)1 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)1 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)1 FileChooser (com.kotcrab.vis.ui.widget.file.FileChooser)1 SingleFileChooserListener (com.kotcrab.vis.ui.widget.file.SingleFileChooserListener)1