当前位置: 首页>>代码示例>>Java>>正文


Java ChoiceDialog.showAndWait方法代码示例

本文整理汇总了Java中javafx.scene.control.ChoiceDialog.showAndWait方法的典型用法代码示例。如果您正苦于以下问题:Java ChoiceDialog.showAndWait方法的具体用法?Java ChoiceDialog.showAndWait怎么用?Java ChoiceDialog.showAndWait使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.ChoiceDialog的用法示例。


在下文中一共展示了ChoiceDialog.showAndWait方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@Override
public DSSPrivateKeyEntry call() throws Exception {
	Map<String, DSSPrivateKeyEntry> map = new HashMap<String, DSSPrivateKeyEntry>();
	for (DSSPrivateKeyEntry dssPrivateKeyEntry : keys) {
		CertificateToken certificate = dssPrivateKeyEntry.getCertificate();
		String text = DSSASN1Utils.getHumanReadableName(certificate) + " (" + certificate.getSerialNumber() + ")";
		map.put(text, dssPrivateKeyEntry);
	}
	Set<String> keySet = map.keySet();
	ChoiceDialog<String> dialog = new ChoiceDialog<String>(keySet.iterator().next(), keySet);
	dialog.setHeaderText("Select your certificate");
	Optional<String> result = dialog.showAndWait();

	try {
		return map.get(result.get());
	} catch (NoSuchElementException e) {
		return null;
	}
}
 
开发者ID:esig,项目名称:dss-demonstrations,代码行数:20,代码来源:SelectCertificateTask.java

示例2: handleSaveAllMenuItem

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@FXML
private void handleSaveAllMenuItem() {
    String entryFormat = ".csv";
    String[] choices = {"CSV file .csv", "Ascii table .txt"};
    ChoiceDialog<String> dialog = FXMLUtils.showOptionDialog(stage, Arrays.asList(choices), "Choose output format", "Choose output format",
            resources.getString("output.format"));
    Optional<String> result = dialog.showAndWait();
    if (result.isPresent()) {
        entryFormat = result.get();

        String coords = stellarObject.getRightAscension() + " " + stellarObject.getDeclination();
        File zip = FXMLUtils.showSaveFileChooser(resources.getString("choose.output.file"),
                lastSavePath,
                "pdr-export-" + entryFormat.split(" ")[0] + "-" + coords,
                stage,
                new FileChooser.ExtensionFilter("Zip file (*.zip)", "*.zip"));
        if (zip != null) {
            updateLastSavePath(zip.getParent());
            toZip(zip, coords + entryFormat);
        }
    }
}
 
开发者ID:m-krajcovic,项目名称:photometric-data-retriever,代码行数:23,代码来源:PhotometricDataOverviewController.java

示例3: changeLanguage

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@FXML
private void changeLanguage(ActionEvent event) {
	List<String> choices = new ArrayList<>();
	choices.add("English");
	choices.add("Deutsch");

	ChoiceDialog<String> dialog = new ChoiceDialog<>("English", choices);
	dialog.setTitle(resources.getString("languagedialog.title"));
	dialog.setHeaderText(resources.getString("languagedialog.headerText"));
	dialog.setContentText(resources.getString("languagedialog.contentText"));

	Optional<String> result = dialog.showAndWait();

	Locale locale = result.isPresent() && result.get().equals("English") ? new Locale("en", "EN")
			: result.isPresent() && result.get().equals("Deutsch") ? new Locale("de", "DE") : resources.getLocale();

	if (!resources.getLocale().toString().equals(locale.toString().substring(0, 2))) {

		this.resources = ResourceBundle.getBundle("bundles.tddt", locale);
		bus.post(new LanguageChangeEvent(resources));
		phaseManager.resetPhase();
	}

}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-team-2,代码行数:25,代码来源:RootLayoutController.java

示例4: show

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
void show(Config config) {
    try {
        List<PcapNetworkInterface> devices = Pcaps.findAllDevs();
        List<String> names = devices.stream().map(PcapNetworkInterface::getName).collect(Collectors.toList());
        ChoiceDialog<String> dialog = new ChoiceDialog<>(names.get(0), names);
        dialog.initModality(Modality.WINDOW_MODAL);
        dialog.setResizable(false);
        dialog.setHeaderText("Choose a network interface:");
        Optional<String> result = dialog.showAndWait();
        if (result.isPresent()) {
            config.setDevice(dialog.getSelectedItem());
            MainWindow app = new MainWindow("Knitcap");
            app.start(config);
        }
    } catch (PcapNativeException e) {
        e.printStackTrace();
    }
}
 
开发者ID:wakamesoba98,项目名称:knitcap,代码行数:19,代码来源:DeviceDialog.java

示例5: removeFiles

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@FXML protected void removeFiles(ActionEvent event) {
    ChoiceDialog<File> dialog = new ChoiceDialog<>(new File(DEFAULT_OPTION), importedSounds);
    dialog.setTitle("Delete Sample");
    dialog.setHeaderText("Choose what sample you would like to delete");
    dialog.setContentText("Sample:");

    Optional<File> result = dialog.showAndWait();
    result.ifPresent(file -> {
        if (!file.toString().equals(DEFAULT_OPTION)) {
            importedSounds.remove(file);
            message.setText(file.getName() + " was removed.");
        }
    });

    event.consume();
}
 
开发者ID:wylliec,项目名称:keymix,代码行数:17,代码来源:Controller.java

示例6: askForBabySteps

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
public String askForBabySteps() {
    List<String> Optionen = new ArrayList<>();
    Optionen.add("Keine BabySteps aktivieren");
    Optionen.add("1:00 Minuten");
    Optionen.add("2:00 Minuten");
    Optionen.add("2:30 Minuten");
    Optionen.add("3:00 Minuten");
    Optionen.add("4:00 Minuten");
    ChoiceDialog<String> dialog = new ChoiceDialog<>("Keine BabySteps aktivieren", Optionen);
    dialog.setTitle("BabySteps");
    dialog.setHeaderText("M" + "\u00F6" + "chtest du BabySteps aktivieren ?\n" +
            "Bei BabySteps wird die Zeit zum Code Schreiben limitiert.");
    dialog.setContentText("Bitte w" + "\u00E4" + "hle deine gew" + "\u00FC" + "nschte Zeit:");
    Optional<String> Auswahl = dialog.showAndWait();
    if (Auswahl.isPresent()) {
        return Auswahl.get();
    }
    return "";
}
 
开发者ID:ProPra16,项目名称:programmierpraktikum-abschlussprojekt-halt-doch-einfach-mal-dein-maul,代码行数:20,代码来源:WarningUnit.java

示例7: selectOwnVersion

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
/**
 * Öffnet einen Dialog, in dem der Spieler auswählen kann,
 * zu welcher KI die hochzuladende Version hinzugefügt werden soll.
 * 
 * @return
 */
public static AiBase selectOwnVersion() {
	
	if (MainApp.ownOnlineAis == null)
		return null;
		
	ObservableList<AiBase> list = FXCollections.observableArrayList();
	list.addAll(MainApp.ownOnlineAis);
	list.add(new AiFake());
	
	ChoiceDialog<AiBase> dialog = new ChoiceDialog<>();
	dialog.getItems().addAll(list);
	dialog.setSelectedItem(list.get(0));
	dialog.setTitle("Version hochladen");
	dialog.setHeaderText("Wähle bitte eine KI aus, zu dem die Version hochgeladen werden soll.");
	dialog.setContentText("KI:");
	
	Optional<AiBase> result = dialog.showAndWait();
	if (result.isPresent()) {
		return result.get();
	}
	return null;
}
 
开发者ID:Turnierserver,项目名称:Turnierserver,代码行数:29,代码来源:Dialog.java

示例8: handleScriptsButtonAction

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@FXML
public void handleScriptsButtonAction() {
    final ChoiceDialog<String> dialog = new ChoiceDialog<>(null, model.getScripts());
    dialog.initOwner(application.getPrimaryStage());
    dialog.setTitle("Scripts");
    dialog.setHeaderText("Select script to run");
    dialog.setContentText("Script:");
    dialog.setSelectedItem(model.getLastRunnedScript());
    final Optional<String> result = dialog.showAndWait();
    if (result.isPresent()) {
        try {
            model.runScript(result.get());
        } catch (final IllegalAccessException e) {
            logger.warning(e.getMessage());
        }
    }
}
 
开发者ID:paspiz85,项目名称:nanobot,代码行数:18,代码来源:MainController.java

示例9: newGame

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@FXML
public void newGame(){
    ChoiceDialog<Integer> dialog = new ChoiceDialog<>(viewModel.sizeProperty().get(), viewModel.getSizeOptions());
    dialog.setTitle("New Game");
    dialog.setHeaderText("Start a new Game");
    dialog.setContentText("Choose the size:");

    Optional<Integer> result = dialog.showAndWait();
    result.ifPresent(size->{
        viewModel.sizeProperty().set(size);

        final ViewTuple<PuzzleView, PuzzleViewModel> viewTuple = FluentViewLoader.fxmlView(PuzzleView.class).load();

        final Parent view = viewTuple.getView();

        center.setMinSize(0,0);
        center.setPrefSize(0,0);

        if(view instanceof Region){
            center.setContent((Region) view);
        }
    });
}
 
开发者ID:lestard,项目名称:nonogram,代码行数:24,代码来源:MainView.java

示例10: showOptionsMessage

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
/**
 * @param parent
 *            dialog parent, if null default parent is used
 * @param message
 *            Question message to show
 * @param choices
 *            possible choices where {@link Pair} value is the choice label displayed
 * @return selected choice or null if canceled
 * @param <T>
 *            choice type
 */
public static <T> T showOptionsMessage(final Window parent, final String message,
		final Collection<Pair<T, String>> choices)
{
	final List<ChoiceWrapper<T>> choiceWrapper = choices.stream()
			.map((c) -> new ChoiceWrapper<T>(c.getKey(), c.getValue()))
			.collect(Collectors.toList());

	final ChoiceDialog<ChoiceWrapper<T>> dialog = new ChoiceDialog<ChoiceWrapper<T>>(choiceWrapper.get(0),
			choiceWrapper);
	initDialog(parent, dialog);
	dialog.setContentText(message);
	dialog.showAndWait();

	final ChoiceWrapper<T> result = dialog.getResult();

	return (result != null ? result.getValue() : null);
}
 
开发者ID:ben12,项目名称:reta,代码行数:29,代码来源:MessageDialog.java

示例11: filter

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@Override public List<String> filter(List<String> values) {
	List<String> ret = new LinkedList<>();
	//when there is only one file, select it. when there is no file, also don't
	//show a dialog.
	if (values.size() < 2) {
		ret.addAll(values);
	}
	else {
		ChoiceDialog<String> dialog = new ChoiceDialog<>(values.get(0), values); //TODO: use Zong! dialog factory
		dialog.setContentText(Lang.getLabel(Voc.SelectDocument));
		Optional<String> selectedFile = dialog.showAndWait();
		//open file
		selectedFile.ifPresent(ret::add);
	}
	return ret;
}
 
开发者ID:Xenoage,项目名称:Zong,代码行数:17,代码来源:FilenameDialogFilter.java

示例12: handleAddItem

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
public void handleAddItem(ActionEvent actionEvent) {
    ChoiceDialog<ChoiceEntry> dialog = new ChoiceDialog<>(null, item_registry);
    dialog.setTitle("Přidat item");
    dialog.setHeaderText("Výběr itemu");
    dialog.setContentText("Vyberte...");
    // Trocha čarování k získání reference na combobox abych ho mohl upravit
    final ComboBox<ChoiceEntry> comboBox = (ComboBox) (((GridPane) dialog.getDialogPane()
        .getContent())
        .getChildren().get(1));
    comboBox.setPrefWidth(100);
    comboBox.setButtonCell(new ChoiceEntryCell());
    comboBox.setCellFactory(param -> new ChoiceEntryCell());
    comboBox.setMinWidth(200);
    comboBox.setMinHeight(40);
    Optional<ChoiceEntry> result = dialog.showAndWait();
    result.ifPresent(choiceEntry -> {
        try {
            final Optional<ItemEntry> entry = items.stream()
                .filter(itemEntry -> itemEntry.getId().equals(choiceEntry.id.get()))
                .findFirst();
            if (!entry.isPresent()) {
                items.add(new ItemEntry(choiceEntry));
            }
        } catch (ItemException e) {
            e.printStackTrace();
        }
    });
}
 
开发者ID:stechy1,项目名称:drd,代码行数:29,代码来源:HeroCreatorController3.java

示例13: actionPerformed

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
/**
 * action to be performed
 *
 * @param ev
 */
public void actionPerformed(ActionEvent ev) {
    final SamplesViewer viewer = (SamplesViewer) getViewer();

    final Collection<String> selected = viewer.getSamplesTable().getSelectedSamples();

    if (selected.size() > 0) {
        String sample = selected.iterator().next();
        String shapeLabel = viewer.getSampleAttributeTable().getSampleShape(sample);
        NodeShape nodeShape = NodeShape.valueOfIgnoreCase(shapeLabel);
        if (nodeShape == null)
            nodeShape = NodeShape.Oval;
        final NodeShape nodeShape1 = nodeShape;

        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                final ChoiceDialog<NodeShape> dialog = new ChoiceDialog<>(nodeShape1, NodeShape.values());
                dialog.setTitle("MEGAN choice");
                dialog.setHeaderText("Choose shape to represent sample(s)");
                dialog.setContentText("Shape:");

                final Optional<NodeShape> result = dialog.showAndWait();
                if (result.isPresent()) {
                    execute("set nodeShape=" + result.get() + " sample='" + Basic.toString(selected, "' '") + "';");
                }
            }
        };
        if (Platform.isFxApplicationThread())
            runnable.run();
        else
            Platform.runLater(runnable);
    }
}
 
开发者ID:danielhuson,项目名称:megan-ce,代码行数:39,代码来源:SetSampleShapeCommand.java

示例14: getChoiceDialog

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
/**
 * returns the selected Choice of the choices array
 * @param title
 * @param header
 * @param content
 * @return
 */
public static Optional<String> getChoiceDialog(String title, String header, String content) {

	log.info("GetAlert called with: " + title + " - " + header + " - " + content);
	
	ChoiceDialog<String> dialog = new ChoiceDialog<>(choices.get(0), choices);
	dialog.setTitle(title);
	dialog.setHeaderText(header);
	dialog.setContentText(content);

	Optional<String> result = dialog.showAndWait();

	return result;
}
 
开发者ID:timgrossmann,项目名称:StorageSystem,代码行数:21,代码来源:Alerter.java

示例15: show

import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
public void show(Config config) {
    List<String> screenSizeList = new ArrayList<>();
    screenSizeList.add("1280x720");
    screenSizeList.add("1920x1080");
    ChoiceDialog<String> dialog = new ChoiceDialog<>(screenSizeList.get(0), screenSizeList);
    dialog.initModality(Modality.WINDOW_MODAL);
    dialog.setResizable(false);
    dialog.setHeaderText("Choose a window size:");
    Optional<String> result = dialog.showAndWait();
    if (result.isPresent()) {
        config.setScreenSize(dialog.getSelectedItem());
        DeviceDialog deviceDialog = new DeviceDialog();
        deviceDialog.show(config);
    }
}
 
开发者ID:wakamesoba98,项目名称:knitcap,代码行数:16,代码来源:WindowSizeDialog.java


注:本文中的javafx.scene.control.ChoiceDialog.showAndWait方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。