當前位置: 首頁>>代碼示例>>Java>>正文


Java FileChooser.setTitle方法代碼示例

本文整理匯總了Java中javafx.stage.FileChooser.setTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java FileChooser.setTitle方法的具體用法?Java FileChooser.setTitle怎麽用?Java FileChooser.setTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.stage.FileChooser的用法示例。


在下文中一共展示了FileChooser.setTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleSelectImage

import javafx.stage.FileChooser; //導入方法依賴的package包/類
public void handleSelectImage(MouseEvent mouseEvent) {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle(imageChooserTitle);
    fileChooser.getExtensionFilters().add(new ExtensionFilter("PNG", "*.png"));
    final File file = fileChooser
        .showOpenDialog(((Node) mouseEvent.getSource()).getScene().getWindow());
    if (file == null) {
        return;
    }

    try {
        final byte[] image = ImageUtils.readImage(file);
        model.imageRaw.set(image);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:stechy1,項目名稱:drd,代碼行數:18,代碼來源:ItemArmorController.java

示例2: exportRootSummaries

import javafx.stage.FileChooser; //導入方法依賴的package包/類
@FXML
void exportRootSummaries(ActionEvent event) throws FileNotFoundException, IOException {
    FileChooser saveChooser = new FileChooser();
    saveChooser.setTitle("Export (Save) data");
    saveChooser.setInitialFileName(pkg.getName() + "_root_path_summary.xlsx");
    File saveFile = saveChooser.showSaveDialog(null);
    if (saveFile != null) {
        FileOutputStream out = new FileOutputStream(saveFile);
        String[] headers = new String[]{
            "Root folder", "Count"
        };
        ReportUtil.exportSpreadsheet(out, pkgContents.getBaseCounts().entrySet(), headers,
                Map.Entry::getKey,
                Map.Entry::getValue
        );
        out.close();
    }
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:aem-epic-tool,代碼行數:19,代碼來源:PackageInfoController.java

示例3: exportMjlog

import javafx.stage.FileChooser; //導入方法依賴的package包/類
public void exportMjlog(ActionEvent actionEvent) throws IOException {
    if (this.tableView.getSelectionModel().getSelectedItem() != null) {
        InfoSchema infoSchema = this.tableView.getSelectionModel().getSelectedItem();
        String content = this.databaseService.findMjlogById(infoSchema.getId());
        if (content != null) {
            FileChooser fileChooser = new FileChooser();
            fileChooser.setInitialFileName(infoSchema.getId());
            fileChooser.setTitle("Save mjlog File");
            fileChooser.getExtensionFilters().add(
                    new FileChooser.ExtensionFilter("mjlog Files", "*.mjlog"));
            File selectedFile = fileChooser.showSaveDialog(this.dateListView.getScene().getWindow());
            if (selectedFile != null) {
                Files.copy(new ByteArrayInputStream(content.getBytes()), selectedFile.toPath());
            }
        }
    }
}
 
開發者ID:CrazyBBB,項目名稱:tenhou-visualizer,代碼行數:18,代碼來源:DownloaderController.java

示例4: loadPlugin

import javafx.stage.FileChooser; //導入方法依賴的package包/類
@FXML
private void loadPlugin() {
  FileChooser chooser = new FileChooser();
  chooser.setTitle("Choose a plugin");
  chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Plugin", "*.jar"));
  List<File> files = chooser.showOpenMultipleDialog(root.getScene().getWindow());
  if (files == null) {
    return;
  }
  files.forEach(f -> {
    try {
      // TODO save this in user preferences
      PluginLoader.getDefault().loadPluginJar(f.toURI());
    } catch (IOException | IllegalArgumentException e) {
      log.log(Level.WARNING, "Could not load jar", e);
      // TODO improve the dialog; use something like what GRIP has
      Alert alert = new Alert(Alert.AlertType.ERROR, null, ButtonType.OK);
      alert.setTitle("Could not load plugins");
      alert.setHeaderText("Plugins in " + f.getName() + " could not be loaded");
      alert.setContentText("Error message:\n\n    " + e.getMessage());
      alert.showAndWait();
    }
  });
}
 
開發者ID:wpilibsuite,項目名稱:shuffleboard,代碼行數:25,代碼來源:PluginPaneController.java

示例5: handleExportToPNG

import javafx.stage.FileChooser; //導入方法依賴的package包/類
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to PNG");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.canvas.getChart(), (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
            throw new RuntimeException(ex);
        }
    }        
}
 
開發者ID:jfree,項目名稱:jfreechart-fx,代碼行數:21,代碼來源:ChartViewer.java

示例6: openFileChooser

import javafx.stage.FileChooser; //導入方法依賴的package包/類
public void openFileChooser(){
	FileChooser fileChooser = new FileChooser();
	ArrayList<String> l = new ArrayList<String>();
	l.add("*.txt");
	l.add("*.text");
	fileChooser.getExtensionFilters().addAll(
               new FileChooser.ExtensionFilter("Fichiers texte",l)
           );
	fileChooser.setTitle("Choisir verbatim Entretien");
	fichierChoisi = fileChooser.showOpenDialog(null);
	if(fichierChoisi != null){
		newEntrFileName.setText(fichierChoisi.getPath());
		canCreate.set(false);
	}
	else {
		newEntrFileName.setText("/");
	}
}
 
開發者ID:coco35700,項目名稱:uPMT,代碼行數:19,代碼來源:NewInterviewDialogController.java

示例7: loadReceiverData

import javafx.stage.FileChooser; //導入方法依賴的package包/類
public void loadReceiverData(ActionEvent actionEvent) {
    FileChooser chooser = new FileChooser();
    Window stage = receiverMenuButton.getScene().getWindow();
    chooser.setTitle("Wybierz plik z danymi odbiorcy");
    chooser.setInitialDirectory(new File(System.getProperty("user.home")));
    File file = chooser.showOpenDialog(stage);
    if (file != null) {
        String jsonData = null;
        try {
            InputStream inputStream = new FileInputStream(file);
            jsonData = org.apache.commons.io.IOUtils.toString(inputStream);

        } catch (IOException e) {
            e.printStackTrace();
        }
        if (jsonData != null) {
            fillReceiverData(new JSONObject(jsonData));
        }
    }

}
 
開發者ID:Garret29,項目名稱:PDF_Invoice_generator,代碼行數:22,代碼來源:GeneratorController.java

示例8: makeChooser

import javafx.stage.FileChooser; //導入方法依賴的package包/類
private FileChooser makeChooser (String extensionAccepted) {
    FileChooser result = new FileChooser();
    result.setTitle("Choose Game XML File");
    // pick a reasonable place to start searching for files
    result.setInitialDirectory(new File(System.getProperty("user.dir")));
    result.getExtensionFilters().setAll(new ExtensionFilter("XML Files", extensionAccepted));
    return result;
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:9,代碼來源:FileLoader.java

示例9: addFileChooser

import javafx.stage.FileChooser; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public WizardStepBuilder addFileChooser(final String fieldName, final String fileChooseLabel, final String startDir,
        final FileChooser.ExtensionFilter... filters)
{
    final WizardStep current = this.current;
    final HBox box = new HBox();
    final JFXButton button = new JFXButton(fileChooseLabel);
    button.setStyle("-fx-text-fill: BLACK;-fx-font-size: 18px;-fx-opacity: 0.7;");
    final FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle(fileChooseLabel);
    fileChooser.setInitialDirectory(new File(startDir));
    fileChooser.getExtensionFilters().addAll(filters);
    this.current.getData().put(fieldName, new SimpleObjectProperty<File>());

    button.setOnAction(
            e -> current.getData().get(fieldName).setValue(fileChooser.showOpenDialog(MineIDE.primaryStage)));

    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(button, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);

    final JFXTextField text = new JFXTextField();
    text.setEditable(false);
    this.current.getData().get(fieldName).addListener(
            (ChangeListener<File>) (observable, oldValue, newValue) -> text.setText(newValue.getAbsolutePath()));

    box.getChildren().addAll(text, button);
    this.current.add(box, 1, this.current.getData().size() - 1);
    return this;
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE,代碼行數:32,代碼來源:WizardStepBuilder.java

示例10: generateBackupCopy

import javafx.stage.FileChooser; //導入方法依賴的package包/類
/**
 * Generates a copy of the database and lets
 * the user choose where to save it
 */
private void generateBackupCopy() {

    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Save Backup Copy");
    fileChooser.setInitialDirectory(
            new File(System.getProperty("user.home"))
    );
    fileChooser.setInitialFileName("Backup Copy " + LocalDate.now() + ".db");
    FileChooser.ExtensionFilter databaseExtensionFilter =
            new FileChooser.ExtensionFilter(
                    "DB - Database (.db)", "*.db");
    fileChooser.getExtensionFilters().add(databaseExtensionFilter);
    fileChooser.setSelectedExtensionFilter(databaseExtensionFilter);
    File backupFile = fileChooser.showSaveDialog(currentStage);

    if (backupFile != null) {
        try {
            File theDatabase = new File(DatabaseHelper.DATABASE_PATH_NAME);
            if (!theDatabase.exists()) {
                DatabaseHelper.createDatabase();
            }
            Files.copy(theDatabase.toPath(), backupFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:kwilliams3,項目名稱:Recordian,代碼行數:32,代碼來源:BackupTabController.java

示例11: saveAs

import javafx.stage.FileChooser; //導入方法依賴的package包/類
@FXML
public boolean saveAs() {
  FileChooser fileChooser = new FileChooser();
  fileChooser.setTitle("Save");
  fileChooser.getExtensionFilters().add(new ExtensionFilter("Style Sheet", "*.css"));
  fileChooser.setInitialDirectory(recentSupport.getLastFile().getParentFile());
  fileChooser.setInitialFileName(currentTabEntity().getValue().name.get());
  File selectedFile = fileChooser.showSaveDialog(stage);
  if (selectedFile == null) {
    return false;
  } else {
    return andFinal(() -> saveToFile(selectedFile),
        b -> ifThat(b).todo(() -> currentTabEntity().getValue().file.setValue(selectedFile)));
  }
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:16,代碼來源:MainFrameController.java

示例12: handleExportToPDF

import javafx.stage.FileChooser; //導入方法依賴的package包/類
/**
 * A handler for the export to PDF option in the context menu.
 */
private void handleExportToPDF() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to PDF");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter(
            "Portable Document Format (PDF)", "pdf");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsPDF(this.canvas.getChart(), (int) getWidth(), 
                (int) getHeight(), file);
    } 
}
 
開發者ID:jfree,項目名稱:jfreechart-fx,代碼行數:16,代碼來源:ChartViewer.java

示例13: exportToCsv

import javafx.stage.FileChooser; //導入方法依賴的package包/類
private void exportToCsv() {
	try {
		FileChooser fileChooser = new FileChooser();
		fileChooser.setTitle("Export to .csv");
		fileChooser.getExtensionFilters().add(new ExtensionFilter("CSV files", "*.csv"));
		File file = fileChooser.showSaveDialog(new Stage());
		if (file == null){
			return;
		}

		BufferedWriter br = new BufferedWriter(new FileWriter(file.getPath()));
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < plotData.getAllTraces().size(); i++) {
			sb.append("\n");
			sb.append(plotData.getAllTraces().get(i).getTraceName());
			sb.append("\n");
			for (int j = 0; j < plotData.getAllTraces().get(i).getxArray().length; j++) {
				if (plotData.getAllTraces().get(i).getxArray() == null) {
					br.close();
					return;
				}
				sb.append(plotData.getAllTraces().get(i).getxArray()[j]);
				if (plotData.getAllTraces().get(i).getyArray() != null) {
					sb.append(",");
					sb.append(plotData.getAllTraces().get(i).getyArray()[j]);
				}
				if (plotData.getAllTraces().get(i).getzArray() != null) {
					sb.append(",");
					sb.append(plotData.getAllTraces().get(i).getzArray()[j]);
				}
				sb.append("\n");
			}
		}
		br.write(sb.toString());
		br.close();
	} catch (IOException e) {
		logger.error("FileWriterException ", e);
	}
	return;
}
 
開發者ID:jasrodis,項目名稱:javafx-dataviewer,代碼行數:41,代碼來源:TopMenu.java

示例14: askFileName

import javafx.stage.FileChooser; //導入方法依賴的package包/類
private File askFileName() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Save JWK File");
    fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("JWK result (*.jwk)", "*.jwk"));
    fileChooser.setInitialFileName("*.jwk");

    File result = fileChooser.showSaveDialog(primaryStage);
    if (result != null) {
        if (!result.getName().endsWith(".jwk")) {
            // FIXME
            throw new RuntimeException(result.getName() + " has no valid JWK-extension.");
        }
    }
    return result;
}
 
開發者ID:atbashEE,項目名稱:atbash-octopus,代碼行數:16,代碼來源:ApplicationMenu.java

示例15: getFileChooserForImage

import javafx.stage.FileChooser; //導入方法依賴的package包/類
private File getFileChooserForImage(final Stage primaryStage) {
    final FileChooser fileChooser = new FileChooser();
    fileChooser.getExtensionFilters()
            .add(new FileChooser.ExtensionFilter("*" + " files (*." + "*" + ")", "*." + "*"));
    Stream.of(ImageFilters.values()).forEach(item -> {
        final String fileExt = item.toString();
        fileChooser.getExtensionFilters()
                .add(new FileChooser.ExtensionFilter(fileExt + " files (*." + fileExt + ")", "*." + fileExt));
    });
    fileChooser.setTitle("Choose your images:");
    return fileChooser.showOpenDialog(primaryStage);
}
 
開發者ID:Evegen55,項目名稱:main_carauto_board,代碼行數:13,代碼來源:ImageViewController.java


注:本文中的javafx.stage.FileChooser.setTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。