Package javafx.stage

Examples of javafx.stage.FileChooser


                config.setKindlegenDir(null);
            }
        }

        if (Objects.isNull(config.getKindlegenDir())) {
            FileChooser fileChooser = new FileChooser();
            fileChooser.setTitle("Select 'kindlegen' File");
            File kindlegenFile = fileChooser.showOpenDialog(null);
            if (Objects.isNull(kindlegenFile))
                return;

            config.setKindlegenDir(kindlegenFile.toPath().getParent().toString());
View Full Code Here


    }

    @FXML
    private void openDoc(ActionEvent event) {
        FileChooser fileChooser = new FileChooser();
        fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Asciidoc","*.asc", "*.asciidoc", "*.adoc", "*.ad", "*.txt"));
        fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("All", "*.*"));
        initialDirectory.ifPresent(e -> {
            if (Files.isDirectory(e))
                fileChooser.setInitialDirectory(e.toFile());
            else
                fileChooser.setInitialDirectory(e.getParent().toFile());
        });
        List<File> chosenFiles = fileChooser.showOpenMultipleDialog(stage);
        if (chosenFiles != null) {
            initialDirectory = Optional.of(chosenFiles.get(0).toPath());
            chosenFiles.stream().map(e -> e.toPath()).forEach(this::addTab);
            recentFiles.addAll(chosenFiles.stream().map(e -> e.toPath()).collect(Collectors.toList()));
        }
View Full Code Here

    @FXML
    public void saveDoc() {
        Path currentPath = current.currentPath();
        if (currentPath == null) {
            FileChooser chooser = new FileChooser();
            chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Asciidoc","*.asc", "*.asciidoc", "*.adoc", "*.ad", "*.txt"));
            File file = chooser.showSaveDialog(null);
            if (file == null)
                return;
            IOHelper.writeToFile(file, (String) current.currentEngine().executeScript("editor.getValue();"), TRUNCATE_EXISTING, CREATE);
            current.putTab(current.getCurrentTab(), file.toPath(), current.currentView());
            current.setCurrentTabText(file.toPath().getFileName().toString());
View Full Code Here

    }
  }

  private void chooseFile()
  {
    FileChooser fc = new FileChooser();
    fc.setTitle("Choose File(s)");

    File dirFile = null;

    if (lastFolder == null)
    {
      dirFile = new File(System.getProperty("user.dir"));
    }
    else
    {
      dirFile = lastFolder;
    }

    fc.setInitialDirectory(dirFile);

    List<File> result = fc.showOpenMultipleDialog(stage);

    if (result != null)
    {
      for (File f : result)
      {
View Full Code Here

    StageManager.addAndShow(jvs);
  }

  private void chooseHotSpotFile()
  {
    FileChooser fc = new FileChooser();
    fc.setTitle("Choose HotSpot log file");

    String osNameProperty = System.getProperty("os.name");

    // don't use ExtensionFilter on OSX due to JavaFX2 missing combo bug
    if (osNameProperty != null && !osNameProperty.toLowerCase().contains("mac"))
    {
      fc.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Log Files", "*.log"),
          new FileChooser.ExtensionFilter("All Files", "*.*"));
    }

    String searchDir = getConfig().getLastLogDir();

    if (searchDir == null)
    {
      searchDir = System.getProperty("user.dir");
    }

    File dirFile = new File(searchDir);

    if (!dirFile.exists() || !dirFile.isDirectory())
    {
      dirFile = new File(System.getProperty("user.dir"));
    }

    fc.setInitialDirectory(dirFile);

    File result = fc.showOpenDialog(stage);

    if (result != null)
    {
      setHotSpotLogFile(result);
    }
View Full Code Here

    }
  }

  private void chooseFile()
  {
    FileChooser fc = new FileChooser();
    fc.setTitle("Choose source file");

    fc.setInitialDirectory(Sandbox.SANDBOX_SOURCE_DIR.toFile());

    File result = fc.showOpenDialog(sandboxStage.getStageForChooser());

    if (result != null)
    {
      loadSource(result.getParentFile(), result.getName());
    }
View Full Code Here

  private void saveFile()
  {
    if (sourceFile == null)
    {
      FileChooser fc = new FileChooser();
      fc.setTitle("Save file as");

      fc.setInitialDirectory(Sandbox.SANDBOX_SOURCE_DIR.toFile());

      sourceFile = fc.showSaveDialog(sandboxStage.getStageForChooser());
    }

    if (sourceFile != null)
    {
      saveFile(sourceFile);
View Full Code Here

    return hbox;
  }

  private File chooseFile(String name)
  {
    FileChooser fc = new FileChooser();
    fc.setTitle("Choose " + name);

    File dirFile = null;

    if (lastFolder == null)
    {
      dirFile = new File(System.getProperty("user.dir"));
    }
    else
    {
      dirFile = lastFolder;
    }

    fc.setInitialDirectory(dirFile);

    File result = fc.showOpenDialog(null);

    if (result != null)
    {
      lastFolder = result.getParentFile();
    }
View Full Code Here

            public void run() {
//                logger.debug("handleOpenFile");

                try {
                    tgfx.Main.postConsoleMessage("[+]Loading a gcode file.....\n");
                    FileChooser fc = new FileChooser();
                    fc.setTitle("Open GCode File");

                    String HOME_DIR = System.getenv("HOME"); //Get Home DIR in OSX
                    if (HOME_DIR == null) {
                        HOME_DIR = System.getProperty("user.home")//Get Home DIR in Windows
                    }

                    fc.setInitialDirectory(new File(HOME_DIR))//This will find osx users home dir
                    File f = fc.showOpenDialog(null);
                    FileInputStream fstream = new FileInputStream(f);
                    DataInputStream in = new DataInputStream((fstream));
                    BufferedReader br = new BufferedReader(new InputStreamReader(in));
                    String strLine;
View Full Code Here

   
    /**
     * A handler for the export to PDF option in the context menu.
     */
    private void handleExportToPDF() {
        FileChooser fileChooser = new FileChooser();
        fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
                "Portable Document Format (PDF)", "pdf"));
        fileChooser.setTitle("Export to PDF");
        File file = fileChooser.showSaveDialog(this.getScene().getWindow());
        if (file != null) {
            ExportUtils.writeAsPDF(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        }
    }
View Full Code Here

TOP

Related Classes of javafx.stage.FileChooser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.