Search in sources :

Example 96 with FileChooser

use of javafx.stage.FileChooser in project Jartop by TheRedSpy15.

the class MoviePlayerController method select.

@FXML
private void select() {
    File file;
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Select a video");
    fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("video Files (.mp4)", "*.mp4"), new FileChooser.ExtensionFilter("All Files", "*.*"));
    file = fileChooser.showOpenDialog(player.getScene().getWindow());
    if (file != null) {
        Media media = new Media("file:" + file.toURI().toString());
        MediaPlayer mediaPlayer = new MediaPlayer(media);
        player.setMediaPlayer(mediaPlayer);
        // volume
        player.getMediaPlayer().setVolume(Core.getUserData().getVolume());
    }
}
Also used : FileChooser(javafx.stage.FileChooser) Media(javafx.scene.media.Media) File(java.io.File) MediaPlayer(javafx.scene.media.MediaPlayer) FXML(javafx.fxml.FXML)

Example 97 with FileChooser

use of javafx.stage.FileChooser in project Jartop by TheRedSpy15.

the class LoginController method select.

@FXML
private void select() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Select a user");
    fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("User Files (." + User.saveExtension + ")", "*" + User.saveExtension));
    userFile = fileChooser.showOpenDialog(wallpaper.getScene().getWindow());
    if (userFile != null) {
        userLbl.setText("Selected User: " + userFile.getName());
        Core.getSecurity().setFailedAttempts((byte) 0);
    }
}
Also used : FileChooser(javafx.stage.FileChooser) FXML(javafx.fxml.FXML)

Example 98 with FileChooser

use of javafx.stage.FileChooser in project tokentool by RPTools.

the class TokenTool_Controller method saveToken.

private void saveToken() {
    FileChooser fileChooser = new FileChooser();
    try {
        File tokenFile = fileSaveUtil.getFileName(false, useFileNumberingCheckbox.isSelected(), fileNameTextField.getText(), fileNameSuffixTextField, true);
        fileChooser.setInitialFileName(tokenFile.getName());
        if (tokenFile.getParentFile() != null)
            if (tokenFile.getParentFile().isDirectory())
                fileChooser.setInitialDirectory(tokenFile.getParentFile());
    } catch (IOException e1) {
        log.error("Error writing token!", e1);
    }
    fileChooser.getExtensionFilters().addAll(AppConstants.IMAGE_EXTENSION_FILTER);
    fileChooser.setTitle(I18N.getString("TokenTool.save.filechooser.title"));
    fileChooser.setSelectedExtensionFilter(AppConstants.IMAGE_EXTENSION_FILTER);
    File tokenSaved = fileChooser.showSaveDialog(saveOptionsPane.getScene().getWindow());
    if (tokenSaved == null)
        return;
    writeTokenImage(tokenSaved);
    updateFileNameTextField(FilenameUtils.getBaseName(tokenSaved.getName()));
    FileSaveUtil.setLastFile(tokenSaved);
    updateOverlayTreeViewRecentFolder(true);
}
Also used : FileChooser(javafx.stage.FileChooser) IOException(java.io.IOException) File(java.io.File)

Example 99 with FileChooser

use of javafx.stage.FileChooser in project FXGL by AlmasB.

the class UINineSliceSample method createImageSaverDialog.

private FileChooser createImageSaverDialog() {
    var fileChooser = new FileChooser();
    fileChooser.setInitialDirectory(new File(System.getProperty("user.dir")));
    fileChooser.setInitialFileName("SliceSample.png");
    fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("PNG", "*.png"));
    return fileChooser;
}
Also used : FileChooser(javafx.stage.FileChooser) File(java.io.File)

Example 100 with FileChooser

use of javafx.stage.FileChooser in project POL-POM-5 by PlayOnLinux.

the class LibrarySideBar method populateAdvancedTools.

/**
     * This method populates the advanced tools button group.
     */
private void populateAdvancedTools() {
    this.runScript = new LeftButton(tr("Run a script"));
    this.runScript.getStyleClass().add("scriptButton");
    this.runConsole = new LeftButton(tr("{0} console", applicationName));
    this.runConsole.getStyleClass().add("consoleButton");
    this.runScript.setOnMouseClicked(event -> {
        final FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle(tr("Open a script"));
        final File scriptToRun = fileChooser.showOpenDialog(null);
        if (scriptToRun != null) {
            onScriptRun.accept(scriptToRun);
        }
    });
    this.runConsole.setOnMouseClicked(event -> onOpenConsole.run());
    this.advancedToolsGroup = new LeftGroup(tr("Advanced tools"), runScript, runConsole);
}
Also used : FileChooser(javafx.stage.FileChooser) File(java.io.File)

Aggregations

FileChooser (javafx.stage.FileChooser)208 File (java.io.File)189 IOException (java.io.IOException)55 FXML (javafx.fxml.FXML)49 Preferences (java.util.prefs.Preferences)24 Button (javafx.scene.control.Button)21 ArrayList (java.util.ArrayList)19 VBox (javafx.scene.layout.VBox)15 ResourceBundle (java.util.ResourceBundle)14 ExtensionFilter (javafx.stage.FileChooser.ExtensionFilter)14 Stage (javafx.stage.Stage)14 Label (javafx.scene.control.Label)13 Alert (javafx.scene.control.Alert)12 List (java.util.List)11 TextField (javafx.scene.control.TextField)11 ScriptException (javax.script.ScriptException)11 Scene (javafx.scene.Scene)10 Map (java.util.Map)9 ObservableList (javafx.collections.ObservableList)9 MenuItem (javafx.scene.control.MenuItem)9