List of usage examples for javafx.stage FileChooser setTitle
public final void setTitle(final String value)
From source file:cz.lbenda.gui.controls.FileField.java
protected EventHandler<ActionEvent> buttonEventHandler() { return event -> { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(CHOOSE_FILE_WINDOW_TITLE); fileChooser.getExtensionFilters().addAll(Constants.allFilesFilter); if (!StringUtils.isBlank(getText())) { fileChooser.setInitialFileName(getText()); File file = new File(getText()); if (file.isDirectory()) { fileChooser.setInitialDirectory(file); } else { fileChooser.setInitialDirectory(file.getParentFile()); }//from w ww .j a v a 2 s. c om } File file; if (isSave()) { file = fileChooser.showSaveDialog(((Node) event.getSource()).getScene().getWindow()); } else { file = fileChooser.showOpenDialog(((Node) event.getSource()).getScene().getWindow()); } if (file != null) { setText(file.getAbsolutePath()); } }; }
From source file:com.advos.notehub.client.util.sandsoft.CustomHTMLEditor.java
/** * Action to do on Import Image button click *//*ww w .ja va 2 s . co m*/ private void onImportFileButtonAction() { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Select a file to import"); fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("All Files", "*.*")); File selectedFile = fileChooser.showOpenDialog(this.getScene().getWindow()); if (selectedFile != null) { importDataFile(selectedFile); } }
From source file:org.apache.cayenne.modeler.layout.SplashLayout.java
public void onOpenClicked() { try {/*from w w w . j ava 2 s.c o m*/ final FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open Cayenne Model"); fileChooser.setInitialDirectory(new File(System.getProperty("user.home"))); fileChooser.getExtensionFilters().addAll( new FileChooser.ExtensionFilter("Cayenne Projects", "cayenne*.xml"), new FileChooser.ExtensionFilter("All Files", "*.*")); final File file = fileChooser.showOpenDialog(getStage()); if (file != null) { CayenneModeler.openProject(file.getAbsolutePath()); hide(); } else { LOGGER.info("Open canceled"); } } catch (final Exception exception) { // TODO Auto-generated catch block LOGGER.error("Could not load Cayenne model", exception); } }
From source file:patcher.FXMLDocumentController.java
@FXML private void handleDirchoose(ActionEvent event) { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open Resource File"); label.setText("trying to open file dialog"); }
From source file:sonicScream.controllers.ProfileManagerController.java
@FXML private void handleImportButtonPressed(ActionEvent event) { SettingsService settings = (SettingsService) ServiceLocator.getService(SettingsService.class); FileChooser chooser = new FileChooser(); chooser.setTitle("Import profile"); chooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("Profiles", "*.xml")); File result = chooser.showOpenDialog(SelectedProfileComboBox.getScene().getWindow()); //TODO: Reimplemnt using JAXB try {/*from w w w .j av a 2 s .c o m*/ JAXBContext context = JAXBContext.newInstance(Profile.class); Profile importedProfile = (Profile) context.createUnmarshaller().unmarshal(result); _profiles.add(importedProfile); selectedProfile.set(importedProfile); settings.addProfile(importedProfile); } catch (ProfileNameExistsException ex) { throw new NotImplementedException("Profile name exists handler not implemented"); //Tell the user a profile with that name already exists. NO CAN DO } catch (JAXBException ex) { throw new NotImplementedException("Invalid profile handler not implemented"); //Tell the user that the profile is improperly formatted. ALSO NO CAN DO } }
From source file:com.playonlinux.javafx.mainwindow.library.ViewLibrary.java
public void setUpEvents() { libraryItems.setOnChange(this::update); runScript.setOnMouseClicked(event -> { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open a script"); File scriptToRun = fileChooser.showOpenDialog(parent); try {//from ww w. j a v a 2 s . c om if (scriptToRun != null) { eventHandlerLibrary.runLocalScript(scriptToRun); } } catch (PlayOnLinuxException e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(translate("Error while trying to run the script.")); alert.setContentText("The file was not found"); LOGGER.warn("Error while trying to run the script", e); } }); runConsole.setOnMouseClicked(event -> runConsole()); }
From source file:isbnfilter.ISBNFilter.java
/** * This Function reads isbn.txt file and creates every single isbn to a * CBook object/*w w w . j a v a 2s.c o m*/ * * @param parent stage where is beeing called * @return strng whit isbn separated by commas * @throws FileNotFoundException * @throws IOException */ public List<String[]> readFile(Stage parent) throws FileNotFoundException, IOException { FileChooser fileChooser = new FileChooser(); String[] separated = null; fileChooser.setTitle("Open Resource File"); File selectedFile = fileChooser.showOpenDialog(parent); List<String[]> everything = new ArrayList(); CSVParser parser = new CSVParser(',', '"'); String[] parsedLine; /*CSVReader reader = null; try { //Get the CSVReader instance with specifying the delimiter to be used reader = new CSVReader(new FileReader(selectedFile),',','"'); String [] nextLine; //Read one line at a time while ((nextLine = reader.readNext()) != null) { everything.add(nextLine); } } catch (Exception e) { e.printStackTrace(); } finally { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } }*/ if (selectedFile != null) { Scanner scanner = new Scanner(selectedFile); BufferedReader br = new BufferedReader(new FileReader(selectedFile.getAbsoluteFile())); try { StringBuilder sb = new StringBuilder(); br.readLine(); String line = br.readLine(); while (line != null) { if (line.charAt(0) == '"') //Algunos traen " al inicio.. los que traen, se los quito line = line.substring(1); separated = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)"); //separated = line.split(","); //Separo todos los datos everything.add(separated); line = br.readLine(); } //everything = sb.toString(); } finally { br.close(); } } return everything; }
From source file:ExcelFx.InitalDataController.java
private String getFilePatch() { FileChooser chooser = new FileChooser(); setExtFilters(chooser);// w w w. j a v a2 s . c om chooser.setTitle("Open File"); File file = chooser.showOpenDialog(gridPane.getScene().getWindow()); if (file != null) { return file.getAbsolutePath(); } return ""; }
From source file:com.coolchick.translatortemplater.Main.java
public boolean spitNewDatabase() { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Choose destination"); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("JSON file(*.json)", "*.json")); File file = fileChooser.showSaveDialog(getStage()); return file != null && spitDatabase(file); }
From source file:com.coolchick.translatortemplater.Main.java
public boolean appendDatabase() { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Choose your JSON database"); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("JSON file(*.json)", "*.json")); File file = fileChooser.showOpenDialog(getStage()); if (file != null) { databaseFile = file;//from ww w. j a v a 2 s . c om return appendDatabase(file); } return false; }