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


Java ComboBox.setValue方法代码示例

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


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

示例1: createLanguageSelector

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
private Node createLanguageSelector () {
    ObservableList<Locale> locales = FXCollections
            .observableArrayList(LocaleManager.getInstance().getSupportedLocales());
    ComboBox<Locale> selector = new ComboBox<>(locales);
    new BasicUIFactory().addStyling(selector, "LangSelect");
    selector.setValue(LocaleManager.getInstance().getCurrentLocaleProperty().get());
    selector.valueProperty().addListener(event -> updateLocale(selector));
    return selector;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:10,代码来源:MainUserInterface.java

示例2: getControlPanel

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
@Override
public Node getControlPanel() {
    VBox box = new VBox();

    ComboBox<CellType> comboBox = new ComboBox<>();
    comboBox.getItems().addAll(CellType.values());
    comboBox.setValue(CellType.STANDARD);
    comboBox.valueProperty().addListener(it -> {
        switch (comboBox.getValue()) {
            case USAGE:
                monthView.setCellFactory(param -> new MonthSheetView.UsageDateCell(param.getView(), param.getDate()));
                break;
            case BADGE:
                monthView.setCellFactory(param -> new MonthSheetView.BadgeDateCell(param.getView(), param.getDate()));
                break;
            case DETAILED:
                monthView.setCellFactory(param -> new MonthSheetView.DetailedDateCell(param.getView(), param.getDate()));
                break;
            case STANDARD:
                monthView.setCellFactory(param -> new MonthSheetView.SimpleDateCell(param.getView(), param.getDate()));
                break;
        }
    });

    box.getChildren().add(comboBox);
    final CalendarPropertySheet propertySheet = new CalendarPropertySheet(monthView.getPropertySheetItems());
    VBox.setVgrow(propertySheet, Priority.ALWAYS);
    box.getChildren().add(propertySheet);

    return box;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:32,代码来源:HelloMonthSheetView.java

示例3: getGroupIdentifier

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public Optional<SecretsGroupIdentifier> getGroupIdentifier() {
    Stage dialog = new Stage();
    dialog.initModality(Modality.WINDOW_MODAL);
    dialog.initOwner(parent);
    dialog.initStyle(StageStyle.UTILITY);

    VBox layout = new VBox();
    Label label = new Label("Create Secrets Group");

    Text nameLabel = new Text("Name:");
    TextField name = new TextField();
    HBox n = new HBox();
    n.getChildren().addAll(nameLabel, name);

    ObservableList<Region> regions =
            FXCollections.observableArrayList(Region.values());

    Text regionLabel = new Text("Region:");
    ComboBox<Region> region = new ComboBox<>(regions);
    region.setValue(defaultRegion);


    HBox r = new HBox();
    r.getChildren().addAll(regionLabel, region);

    HBox actions = new HBox();
    Button create = new Button("Create");
    Button cancel = new Button("Cancel");
    actions.getChildren().addAll(create, cancel);

    create.setOnAction(f -> {
        if (name.getText() != null) {
            secretsGroupIdentifier = Optional.of(new SecretsGroupIdentifier(region.getValue(), name.getText()));
        }
        dialog.close();
    });

    cancel.setOnAction(f -> {
        dialog.close();
    });

    layout.getChildren().addAll(label, n, r, actions);

    Scene scene2 = new Scene(layout, 370, 250);
    dialog.setScene(scene2);

    dialog.showAndWait();


    return secretsGroupIdentifier;
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:52,代码来源:GetGroupIdentifier.java

示例4: create

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public static <T extends Enum<T>> ComboBox<T> create(Class<T> enumType, T defaultEnumValue) {

        List<T> entries = new ArrayList<>();
        Collections.addAll(entries, enumType.getEnumConstants());

        ObservableList<T> observableList = FXCollections.observableList(entries);
        ComboBox<T> comboBox = new ComboBox<T>(observableList);
        comboBox.setValue(defaultEnumValue);

        return comboBox;
    }
 
开发者ID:schibsted,项目名称:strongbox,代码行数:12,代码来源:EnumComboBox.java

示例5: createComboBox

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
private ComboBox<String> createComboBox(){
	final ComboBox<String> languageComboBox = new ComboBox<String>();
	String number = resources.getString("languageNumber");
	int n = number.charAt(0)-'0';
	for(int i = 0 ; i < n; i++){
		languageComboBox.getItems().add(resources.getString("language" + (i + 1)));
	}
	//default language
	languageComboBox.setValue("English");
	return languageComboBox;
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:12,代码来源:PasswordManager.java

示例6: showFileMovableDialog

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public Pair<FileAction, String[]> showFileMovableDialog(String bucket, String key, boolean setKey) {
	MainWindowController main = MainWindowController.getInstance();
	ButtonType ok = new ButtonType(Values.OK, ButtonData.OK_DONE);
	Dialog<String[]> dialog = getDialog(ok);

	TextField keyTextField = new TextField();
	keyTextField.setPrefWidth(300);
	keyTextField.setPromptText(Values.FILE_NAME);
	keyTextField.setText(key);
	ComboBox<String> bucketCombo = new ComboBox<String>();
	bucketCombo.getItems().addAll(main.bucketChoiceCombo.getItems());
	bucketCombo.setValue(bucket);
	CheckBox copyasCheckBox = new CheckBox(Values.COPY_AS);
	copyasCheckBox.setSelected(true);

	GridPane grid = getGridPane();
	grid.add(copyasCheckBox, 0, 0, 2, 1);
	grid.add(new Label(Values.BUCKET_NAME), 0, 1);
	grid.add(bucketCombo, 1, 1);
	if (setKey) {
		grid.add(new Label(Values.FILE_NAME), 0, 2);
		grid.add(keyTextField, 1, 2);
		Platform.runLater(() -> keyTextField.requestFocus());
	}

	dialog.getDialogPane().setContent(grid);
	dialog.setResultConverter(dialogButton -> {
		if (dialogButton == ok) {
			return new String[] { bucketCombo.getValue(), keyTextField.getText() };
		}
		return null;
	});

	Optional<String[]> result = dialog.showAndWait();
	if (result.isPresent()) {
		bucket = bucketCombo.getValue();
		key = keyTextField.getText();
		FileAction action = copyasCheckBox.isSelected() ? FileAction.COPY : FileAction.MOVE;
		return new Pair<FileAction, String[]>(action, new String[] { bucket, key });
	} else {
		return null;
	}
}
 
开发者ID:zhazhapan,项目名称:qiniu,代码行数:44,代码来源:Dialogs.java

示例7: showBucketAddableDialog

import javafx.scene.control.ComboBox; //导入方法依赖的package包/类
public void showBucketAddableDialog() {
	ButtonType ok = new ButtonType(Values.OK, ButtonData.OK_DONE);
	Dialog<String[]> dialog = getDialog(ok);

	TextField bucket = new TextField();
	bucket.setPromptText(Values.BUCKET_NAME);
	TextField url = new TextField();
	url.setPromptText(Values.BUCKET_URL);
	// TextField zone = new TextField();
	ComboBox<String> zone = new ComboBox<String>();
	zone.getItems().addAll(Values.BUCKET_NAME_ARRAY);
	zone.setValue(Values.BUCKET_NAME_ARRAY[0]);

	GridPane grid = getGridPane();
	grid.add(new Label(Values.BUCKET_NAME), 0, 0);
	grid.add(bucket, 1, 0);
	grid.add(new Label(Values.BUCKET_URL), 0, 1);
	grid.add(url, 1, 1);
	grid.add(new Label(Values.BUCKET_ZONE_NAME), 0, 2);
	grid.add(zone, 1, 2);

	Node okButton = dialog.getDialogPane().lookupButton(ok);
	okButton.setDisable(true);

	// 监听文本框的输入状态
	bucket.textProperty().addListener((observable, oldValue, newValue) -> {
		okButton.setDisable(newValue.trim().isEmpty() || url.getText().isEmpty());
	});
	url.textProperty().addListener((observable, oldValue, newValue) -> {
		okButton.setDisable(newValue.trim().isEmpty() || bucket.getText().isEmpty());
	});

	dialog.getDialogPane().setContent(grid);

	Platform.runLater(() -> bucket.requestFocus());

	dialog.setResultConverter(dialogButton -> {
		if (dialogButton == ok) {
			return new String[] { bucket.getText(),
					zone.getValue() + " " + (Checker.isHyperLink(url.getText()) ? url.getText() : "example.com") };
		}
		return null;
	});

	Optional<String[]> result = dialog.showAndWait();
	result.ifPresent(res -> {
		logger.info("bucket name: " + res[0] + ", zone name: " + res[1]);
		Platform.runLater(() -> MainWindowController.getInstance().addItem(res[0]));
		QiniuApplication.buckets.put(res[0], res[1]);
		ConfigLoader.writeConfig();
	});
}
 
开发者ID:zhazhapan,项目名称:qiniu,代码行数:53,代码来源:Dialogs.java


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