Ejemplo n.º 1
0
 @FXML
 private void saveCode() {
   FileChooser fc = new FileChooser();
   fc.setTitle("保存先を指定");
   fc.setInitialFileName(contest.getSelectionModel().getSelectedItem().getValue());
   fc.getExtensionFilters().addAll(Extension.getFilterList());
   fc.setSelectedExtensionFilter(Extension.of(languageLabel.getText()).getFilter());
   Optional.ofNullable(fc.showSaveDialog(root.getScene().getWindow()))
       .ifPresent(
           f -> {
             try {
               Files.write(f.toPath(), ((String) obj.call("getCode")).getBytes());
             } catch (IOException e) {
             }
           });
 }