本文整理汇总了Java中javafx.scene.control.ChoiceDialog.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java ChoiceDialog.setTitle方法的具体用法?Java ChoiceDialog.setTitle怎么用?Java ChoiceDialog.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ChoiceDialog
的用法示例。
在下文中一共展示了ChoiceDialog.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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
示例2: 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();
}
示例3: 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
示例4: 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;
}
示例5: 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());
}
}
}
示例6: 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);
}
});
}
示例7: 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();
}
});
}
示例8: showOptionDialog
import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
public static ChoiceDialog<String> showOptionDialog(Window owner, List<String> choices,
String title,
String header,
String content) {
ChoiceDialog<String> dialog = new ChoiceDialog<>(choices.get(0), choices);
dialog.setTitle(title);
dialog.setHeaderText(header);
dialog.setContentText(content);
return dialog;
}
示例9: 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);
}
}
示例10: 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;
}
示例11: clickLetter
import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
@FXML protected void clickLetter(ActionEvent event) {
String id = ((Node)event.getTarget()).idProperty().getValue();
ChoiceDialog<File> dialog = new ChoiceDialog<>(new File(DEFAULT_OPTION), importedSounds);
dialog.setTitle("Choose Sample");
dialog.setHeaderText("Choose what sample you would like to map to letter " + id);
dialog.setContentText("Sample:");
Optional<File> result = dialog.showAndWait();
result.ifPresent(file -> this.mapKey(file, id));
event.consume();
}
示例12: showChoiceDialog
import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
public static <T> T showChoiceDialog(final String title, final String message, final T[] choices, final T defaultChoice) {
if (Platform.isFxApplicationThread()) {
ChoiceDialog<T> dialog = new ChoiceDialog<>(defaultChoice, choices);
dialog.setTitle(title);
dialog.getDialogPane().setHeaderText(null);
if (message != null)
dialog.getDialogPane().setContentText(message);
Optional<T> result = dialog.showAndWait();
if (result.isPresent())
return result.get();
return null;
} else
return (T)JOptionPane.showInputDialog(getPossibleParent(), message, title, JOptionPane.PLAIN_MESSAGE, null, choices, defaultChoice);
}
示例13: createGreenhouseDialog
import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
public Button createGreenhouseDialog(Farming farm) {
String name = farm.getBuilding().getNickName();
Button b = new Button(name);
b.setMaxWidth(Double.MAX_VALUE);
List<String> choices = new ArrayList<>();
choices.add("Lettuce");
choices.add("Green Peas");
choices.add("Carrot");
ChoiceDialog<String> dialog = new ChoiceDialog<>("List of Crops", choices);
dialog.setTitle(name);
dialog.setHeaderText("Plant a Crop");
dialog.setContentText("Choose Your Crop:");
dialog.initOwner(stage); // post the same icon from stage
dialog.initStyle(StageStyle.UTILITY);
//dialog.initModality(Modality.NONE);
b.setPadding(new Insets(20));
b.setId("settlement-node");
b.getStylesheets().add("/fxui/css/settlementnode.css");
b.setOnAction(e->{
// The Java 8 way to get the response value (with lambda expression).
Optional<String> selected = dialog.showAndWait();
selected.ifPresent(crop -> System.out.println("Crop added to the queue: " + crop));
});
//ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
//ButtonType buttonTypeOk = new ButtonType("OK", ButtonData.OK_DONE);
//dialog.getButtonTypes().setAll(buttonTypeCancel, buttonTypeOk);
return b;
}
示例14: showChoiceDialog
import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
public static Optional<String> showChoiceDialog(String title, String message, List<String> choices) {
ChoiceDialog<String> dialog = new ChoiceDialog<>(choices.get(0), choices);
dialog.setTitle(title);
dialog.setHeaderText(message);
return dialog.showAndWait();
}
示例15: configInstance
import javafx.scene.control.ChoiceDialog; //导入方法依赖的package包/类
private VidadaInstanceConfig configInstance(){
List<VidadaInstanceConfig> allVidadaInstanceConfigs = new ArrayList<>(VidadaClientSettings.instance().getVidadaInstances());
logger.info("Configuring Vidada Instance form found " + allVidadaInstanceConfigs.size() + " configurations.");
if(allVidadaInstanceConfigs.size() > 1) {
logger.info("Multiple instance configurations are available, user has to choose...");
// Multiple instances to choose from
ChoiceDialog<VidadaInstanceConfig> dialog = new StyledChoiceDialog<>(allVidadaInstanceConfigs.get(0), allVidadaInstanceConfigs);
dialog.setTitle("Vidada Instance Chooser");
dialog.setHeaderText("Choose to which Vidada Instance you want to connect.");
dialog.showAndWait().ifPresent(config -> VidadaClientSettings.instance().setCurrentInstnace(config));
}else if(allVidadaInstanceConfigs.size() == 1){
logger.info("Automatically configure the only available instance.");
VidadaClientSettings.instance().setCurrentInstnace(allVidadaInstanceConfigs.get(0));
}else if(allVidadaInstanceConfigs.size() == 0){
logger.warn("No instance configuration found. Check your client settings!");
}
logger.debug("Vidada instance configured.");
return VidadaClientSettings.instance().getCurrentInstance();
}