List of usage examples for javafx.stage FileChooser setTitle
public final void setTitle(final String value)
From source file:dsfixgui.FileIO.DSFixFileController.java
public void loadDSFConfig() { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(DIALOG_TITLE_IMPORT_INI); FileChooser.ExtensionFilter iniFilter = new FileChooser.ExtensionFilter(INI_EXT_FILTER[0], INI_EXT_FILTER[1]);//from w w w . ja va2 s.c o m fileChooser.getExtensionFilters().add(iniFilter); File importedFile = fileChooser.showOpenDialog(ui.getStage()); if (importedFile != null) { ui.getConfig().loadSettingsFromIniFile(importedFile.getPath()); } }
From source file:dsfixgui.FileIO.DSFixFileController.java
public void loadDSFKeybinds() { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(DIALOG_TITLE_IMPORT_INI); FileChooser.ExtensionFilter iniFilter = new FileChooser.ExtensionFilter(INI_EXT_FILTER[0], INI_EXT_FILTER[1]);//from w ww .j a v a 2s . c o m fileChooser.getExtensionFilters().add(iniFilter); File importedFile = fileChooser.showOpenDialog(ui.getStage()); if (importedFile != null) { ui.getDSFKeybinds().loadSettingsFromIniFile(importedFile.getPath()); } }
From source file:ch.unibas.charmmtools.gui.step1.mdAssistant.CHARMM_GUI_InputAssistant.java
/** * Handles the event when one of the 3 button_open_XXX is pressed button_generate is enabled only when the 3 files * have been loaded/*w ww. ja v a 2s .c o m*/ * * @param event */ @FXML protected void OpenButtonPressed(ActionEvent event) { Window myParent = button_generate.getScene().getWindow(); FileChooser chooser = new FileChooser(); chooser.setInitialDirectory(new File(".")); File selectedFile = null; chooser.setTitle("Open File"); if (event.getSource().equals(button_open_PAR)) { chooser.getExtensionFilters().add( new FileChooser.ExtensionFilter("CHARMM FF parameters file (*.par,*.prm)", "*.par", "*.prm")); selectedFile = chooser.showOpenDialog(myParent); if (selectedFile != null) { textfield_PAR.setText(selectedFile.getAbsolutePath()); PAR_selected = true; } } else if (event.getSource().equals(button_open_RTF)) { chooser.getExtensionFilters().add( new FileChooser.ExtensionFilter("CHARMM FF topology file (*.top,*.rtf)", "*.top", "*.rtf")); selectedFile = chooser.showOpenDialog(myParent); if (selectedFile != null) { textfield_RTF.setText(selectedFile.getAbsolutePath()); RTF_selected = true; } } else if (event.getSource().equals(button_open_COR_gas)) { chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Coordinates file (*.pdb)", "*.pdb")); selectedFile = chooser.showOpenDialog(myParent); if (selectedFile != null) { textfield_COR_gas.setText(selectedFile.getAbsolutePath()); COR_selected_gas = true; } } else if (event.getSource().equals(button_open_COR_liquid)) { chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Coordinates file (*.pdb)", "*.pdb")); selectedFile = chooser.showOpenDialog(myParent); if (selectedFile != null) { textfield_COR_liquid.setText(selectedFile.getAbsolutePath()); COR_selected_liquid = true; } } else if (event.getSource().equals(button_open_COR_solv)) { chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Coordinates file (*.pdb)", "*.pdb")); selectedFile = chooser.showOpenDialog(myParent); if (selectedFile != null) { textfield_COR_solv.setText(selectedFile.getAbsolutePath()); COR_selected_solv = true; } } else if (event.getSource().equals(button_open_LPUN)) { chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("LPUN file", "*.lpun")); selectedFile = chooser.showOpenDialog(myParent); if (selectedFile != null) { textfield_LPUN.setText(selectedFile.getAbsolutePath()); LPUN_selected = true; } } else { throw new UnknownError("Unknown Event in OpenButtonPressed(ActionEvent event)"); } this.validateButtonGenerate(); }
From source file:mesclasses.view.RapportEleveController.java
@FXML public void importFile() { FileChooser chooser = new FileChooser(); PropertiesCache cache = PropertiesCache.getInstance(); String lastDir = cache.getProperty(PropertiesCache.LAST_UPLOAD_DIR); if (lastDir != null && new File(lastDir).exists()) { chooser.setInitialDirectory(new File(lastDir)); }// w w w . ja va 2 s. c o m chooser.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*.*")); chooser.setTitle("Slectionnez un fichier"); File file = chooser.showOpenDialog(primaryStage); if (file == null) { return; } cache.setProperty(PropertiesCache.LAST_UPLOAD_DIR, file.getParent()); try { EleveFileUtil.copyFileForEleve(eleve, file, selectedFileType.get()); } catch (IOException e) { ModalUtil.alert("Erreur lors de l'import du fichier", e.getMessage()); return; } refreshGrid(); }
From source file:open.dolphin.client.MainWindowController.java
@FXML protected void fileChoose() { FileChooser fc = new FileChooser(); fc.setTitle("select file"); fc.setInitialDirectory(new File(System.getProperty("user.home"))); fc.getExtensionFilters().add(new ExtensionFilter("????", "*.*")); File f = fc.showOpenDialog(null); if (f != null) { try {/* www.j a va2s . c o m*/ Path path = f.toPath(); choiceFile.setText(path.getFileName().toString()); for (String s : Files.readAllLines(path, Charset.forName("SJIS"))) { System.out.println(s); } } catch (IOException ex) { Logger.getLogger(MainWindowController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:view.EditorView.java
@FXML void menuItemOpenOnAction(@SuppressWarnings("unused") ActionEvent event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open a game file"); File file = fileChooser.showOpenDialog(stage); if (file != null) { // if file == null the action was aborted try {//from w ww .ja va 2s . com loadGame(file); } catch (IOException | ClassNotFoundException e) { FOKLogger.log(MainWindow.class.getName(), Level.SEVERE, "Failed to open game " + file.toString(), e); new Alert(Alert.AlertType.ERROR, "Could not open the game file: \n\n" + ExceptionUtils.getRootCauseMessage(e)).show(); } } }
From source file:view.EditorView.java
@FXML void menuItemSaveAsOnAction(@SuppressWarnings("unused") ActionEvent event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Save game file"); File file = fileChooser.showSaveDialog(stage); if (file != null) { // if file == null the action was aborted try {//ww w . j a v a 2s . c o m getCurrentGame().save(file); } catch (IOException e) { FOKLogger.log(MainWindow.class.getName(), Level.SEVERE, "Could not save the game from the \"Save As\" menu", e); new Alert(Alert.AlertType.ERROR, "Could not save the game file: \n\n" + ExceptionUtils.getRootCauseMessage(e)).show(); } } }
From source file:ninja.javafx.smartcsv.fx.SmartCSVController.java
private void loadFile(String filterText, String filter, String title, FileStorage storageFile) { final FileChooser fileChooser = new FileChooser(); //Set extension filter final FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(filterText, filter); fileChooser.getExtensionFilters().add(extFilter); fileChooser.setTitle(title); if (storageFile.getFile() != null) { fileChooser.setInitialDirectory(storageFile.getFile().getParentFile()); }// ww w . ja va2s . com //Show open file dialog File file = fileChooser.showOpenDialog(applicationPane.getScene().getWindow()); if (file != null) { storageFile.setFile(file); useLoadFileService(storageFile, t -> resetContent()); } }
From source file:org.noroomattheinn.visibletesla.MainController.java
private void exportStats(String[] columns) { String initialDir = prefs.storage().get(App.LastExportDirKey, System.getProperty("user.home")); FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export Data"); fileChooser.setInitialDirectory(new File(initialDir)); File file = fileChooser.showSaveDialog(app.stage); if (file != null) { String enclosingDirectory = file.getParent(); if (enclosingDirectory != null) prefs.storage().put(App.LastExportDirKey, enclosingDirectory); Range<Long> exportPeriod = DateRangeDialog.getExportPeriod(app.stage); if (exportPeriod == null) return; if (vtData.export(file, exportPeriod, columns)) { Dialogs.showInformationDialog(app.stage, "Your data has been exported", "Data Export Process", "Export Complete"); } else {// w ww . j a v a2 s. c om Dialogs.showErrorDialog(app.stage, "Unable to save to: " + file, "Data Export Process", "Export Failed"); } } }
From source file:io.github.mzmine.modules.plots.msspectrum.MsSpectrumPlotWindowController.java
public void handleExportMSP(Event event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export to MSP"); fileChooser.getExtensionFilters().add(new ExtensionFilter("NIST MSP format", "*.msp")); // Remember last directory if (lastSaveDirectory != null && lastSaveDirectory.isDirectory()) fileChooser.setInitialDirectory(lastSaveDirectory); // Show the file chooser File file = fileChooser.showSaveDialog(chartNode.getScene().getWindow()); // If nothing was chosen, quit if (file == null) return;//from w ww . j a va 2 s .co m // Save the last open directory lastSaveDirectory = file.getParentFile(); final List<MsSpectrum> spectra = new ArrayList<>(); for (MsSpectrumDataSet dataset : datasets) { spectra.add(dataset.getSpectrum()); } // Do the export in a new thread final File finalFile = file; new Thread(() -> { try { MspExportAlgorithm.exportSpectra(finalFile, spectra); } catch (Exception e) { MZmineGUI.displayMessage("Unable to export: " + e.getMessage()); e.printStackTrace(); } }).start(); }