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());
}
}
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);
}
}
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);
}
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;
}
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);
}
Aggregations