当前位置: 首页>>代码示例>>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;未经允许,请勿转载。