private void onOpenFileClicked() { FileChooser chooser = new FileChooser(); chooser.setTitle("Load source from file"); File file = chooser.showOpenDialog(designerRoot.getMainStage()); loadSourceFromFile(file); }
@Override public void openProject(ReuseStage reuse) { final FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open .json File"); fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("JSON files (*.json)", "*.json")); final File file = fileChooser.showOpenDialog(stage); if (file != null) { configFileHelper.loadConfigFile(file, reuse); } }
/** * init fxml when loaded. */ @PostConstruct public void init() throws Exception { final Stage stage = (Stage) context.getRegisteredObject("Stage"); glyphDetailViewer = new GlyphDetailViewer(); detailsContainer.getChildren().add(glyphDetailViewer); ScrollPane scrollableGlyphs = allGlyphs(); scrollableGlyphs.setStyle(FX_BACKGROUND_INSETS_0); iconsContainer.getChildren().add(scrollableGlyphs); browseFont.setOnAction((action) -> { FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("SVG files (*.svg)", "*.svg"); fileChooser.getExtensionFilters().add(extFilter); File file = fileChooser.showOpenDialog(stage); if (file != null) { SVGGlyphLoader.clear(); try { SVGGlyphLoader.loadGlyphsFont(new FileInputStream(file), file.getName()); ScrollPane newglyphs = allGlyphs(); newglyphs.setStyle(FX_BACKGROUND_INSETS_0); iconsContainer.getChildren().clear(); iconsContainer.getChildren().add(newglyphs); } catch (IOException ioExc) { ioExc.printStackTrace(); } } }); }
final File file = fileChooser.showOpenDialog(ui.getStage()); if (file != null) { fieldFile.setText(Paths.get(".").toAbsolutePath().getParent().relativize(file.toPath()).toString());
/** * Shows the file chooser dialog of the given type * * @param ownerWindow * the window owning the dialog * @param type * @return the selected file or null */ public File showDialog(Window ownerWindow, OpenType type) { File selected = null; switch (type) { case SAVE: selected = wrapped.showSaveDialog(ownerWindow); break; default: selected = wrapped.showOpenDialog(ownerWindow); } notifyNewLatestDirectory(selected); return selected; }
private void fileChoosen() { final File chosen = chooser.showOpenDialog(null); if (chosen != null) { choosenFullPath.setText(chosen.getAbsolutePath()); } }
@Override public Path showOpenDialog() { fileChooser.setTitle(resourceBundle.getString("fileChooser.open.title")); File file = fileChooser.showOpenDialog(mainWindowProvider.getMainWindow()); if (file != null) { Path filePath = file.toPath(); setInitialDirectory(filePath); return filePath; } else { return null; } }
public void chooseAndOpenCsvFile() { FileChooser chooser = new FileChooser(); ExtensionFilter filter = new ExtensionFilter( "Comma-Separated-Values", "csv"); chooser.setSelectedExtensionFilter(filter); File f = chooser.showOpenDialog(stage); if (null != f) { try { openCsvFile(f); } catch (Exception ex) { Logger.getLogger(MainJFrame.class.getName()).log(Level.SEVERE, null, ex); } } }
@Override public void handle(final ActionEvent e) { File file; if ("File".equals(fieldType)) file = getFileChooser().showOpenDialog(stage); else file = getDirectoryChooser().showDialog(stage); if (file != null) { textField.setText(file.getPath()); } } });
switch(type){ case OPEN: File f = chooser.showOpenDialog(parent); if(f != null){ files.add(f);
public void chooseCssFile() { File cssDir; try { URL currUrl = new URL(cssUrl.textProperty().getValue()); String path = currUrl.getPath(); File file = new File(path); cssDir = file.getParentFile(); } catch (Exception e) { cssDir = null; } if(cssDir == null) { cssDir = new File(System.getProperty("user.dir")); } FileChooser fileChooser = new FileChooser(); if(cssDir.isDirectory()) { fileChooser.setInitialDirectory(cssDir); } File file = fileChooser.showOpenDialog(null); if (file != null) { try { String url = file.toURI().toURL().toExternalForm(); cssUrl.textProperty().setValue(url); updatePreview(); } catch (MalformedURLException e) { e.printStackTrace(); } } }
private File openFileChooser(Stage stage, String description, String extension) { fileChooser.setTitle("Choose Feature File"); fileChooser.setInitialDirectory(workingDir); FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter(description, extension); fileChooser.getExtensionFilters().setAll(extFilter); return fileChooser.showOpenDialog(stage); }
public void chooseFile() { FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("HTML file"); fileChooser.getExtensionFilters().addAll( new FileChooser.ExtensionFilter("HTML files", "*.html", "*.htm"), new FileChooser.ExtensionFilter("All files", "*.*") ); String initialDirPath = System.getProperty("user.dir"); File initialDir = new File(initialDirPath); fileChooser.setInitialDirectory(initialDir); File htmlFile = fileChooser.showOpenDialog(getScene().getWindow()); if(htmlFile != null) { txtFile.setText(htmlFile.getAbsolutePath()); } }
File newExecutable = chooser.showOpenDialog(getControl().getScene().getWindow()); if (newExecutable != null) { executable.setText(newExecutable.toString());
File newMiniature = chooser.showOpenDialog(getControl().getScene().getWindow()); if (newMiniature != null) { miniature.setText(newMiniature.toString());
/** * This method populates the advanced tools button group. */ private SidebarGroup<Button> createAdvancedToolsGroup() { final Button createShortcut = new Button(tr("Create shortcut")); createShortcut.getStyleClass().addAll("sidebarButton", "openTerminal"); createShortcut.setOnMouseClicked(event -> onCreateShortcut.run()); final Button runScript = new Button(tr("Run a script")); runScript.getStyleClass().addAll("sidebarButton", "scriptButton"); runScript.setOnMouseClicked(event -> { final FileChooser fileChooser = new FileChooser(); fileChooser.setTitle(tr("Open Script...")); // TODO: use correct owner window final File scriptToRun = fileChooser.showOpenDialog(null); if (scriptToRun != null) { onScriptRun.accept(scriptToRun); } }); final Button runConsole = new Button(tr("{0} console", applicationName)); runConsole.getStyleClass().addAll("sidebarButton", "consoleButton"); runConsole.setOnMouseClicked(event -> onOpenConsole.run()); SidebarGroup<Button> advancedToolsGroup = new SidebarGroup<>(tr("Advanced Tools")); advancedToolsGroup.getComponents().addAll(createShortcut, /* runScript, */runConsole); return advancedToolsGroup; }
private void startReading() { FileChooser fileChooser = new FileChooser(); fileChooser.setSelectedExtensionFilter(new ExtensionFilter("IHMC lidar scan log file.", ".ihmcLidarLog")); File file = fileChooser.showOpenDialog(mainWindow); if (file != null) { writingProperty().set(false); enableNetworkProcessorClientProperty().set(false); enableLoggerServerProperty().set(true); logReader.startReading(file); } else { readingProperty().set(false); } }
private void startReading() { FileChooser fileChooser = new FileChooser(); fileChooser.setSelectedExtensionFilter(new ExtensionFilter("IHMC lidar scan log file.", ".ihmcLidarLog")); File file = fileChooser.showOpenDialog(mainWindow); if (file != null) { writingProperty().set(false); enableNetworkProcessorClientProperty().set(false); enableLoggerServerProperty().set(true); logReader.startReading(file); } else { readingProperty().set(false); } }
File dialogResult = fileChooser.showOpenDialog(null); if (dialogResult != null) { selectFile(dialogResult);
@Override public Node createValueVisualisation() { HBox hBox = new HBox(3); Label status = new Label(labelText()); observableAttributeValue.addListener(observable -> status.setText(labelText())); FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Open Resource File"); if (bytes.internal_getFileExtension() != null) { fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Files", "*." + bytes.internal_getFileExtension())); } final Button openButton = new Button("Open Resource File..."); openButton.setOnAction(e -> { File file = fileChooser.showOpenDialog(openButton.getScene().getWindow()); if (file != null) { openFile(file); } }); final Button clear = new Button("Clear"); clear.setOnAction(e -> bytes.set((String) null)); hBox.setAlignment(Pos.CENTER_LEFT); HBox.setHgrow(status, Priority.SOMETIMES); hBox.getChildren().addAll(openButton, clear, status); hBox.disableProperty().bind(readOnly); return hBox; }