本文整理汇总了Java中javafx.scene.control.ChoiceBox.setId方法的典型用法代码示例。如果您正苦于以下问题:Java ChoiceBox.setId方法的具体用法?Java ChoiceBox.setId怎么用?Java ChoiceBox.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ChoiceBox
的用法示例。
在下文中一共展示了ChoiceBox.setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ObjectPropertyValueSetter
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
public ObjectPropertyValueSetter(Property listeningProperty, BindingType btype, Object testedControl, List values) {
try {
ChoiceBox cb = new ChoiceBox();
cb.setMaxWidth(175.0);
cb.setId(createId(listeningProperty, btype));
cb.setItems(FXCollections.observableArrayList(values));
cb.getSelectionModel().selectFirst();
leadingControl = cb;
this.leadingProperty = cb.valueProperty();
this.listeningProperty = listeningProperty;
propertyValueType = PropertyValueType.OBJECTENUM;
initialValue1 = !values.isEmpty() ? values.get(0) : null;
bindComponent(btype, testedControl);
} catch (Throwable ex) {
log(ex);
}
}
示例2: NodesChoserFactory
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
/**
* For all controls except menu.
*
* @param actionName title on button.
* @param handler action, which will be called, when button will be clicked
* and selected node will be given as argument.
* @param additionalNodes nodes between ChoiceBox with different controls
* and action button. You can add and process them, when action happens.
*/
public NodesChoserFactory(String actionName, final NodeAction<Node> handler, Node additionalNodes) {
final ChoiceBox<NodeFactory> cb = new ChoiceBox<NodeFactory>();
cb.setId(NODE_CHOSER_CHOICE_BOX_ID);
cb.getItems().addAll(ControlsFactory.filteredValues());
cb.getItems().addAll(Shapes.values());
cb.getItems().addAll(Panes.values());
Button actionButton = new Button(actionName);
actionButton.setId(NODE_CHOOSER_ACTION_BUTTON_ID);
actionButton.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent t) {
handler.execute(cb.getSelectionModel().getSelectedItem().createNode());
}
});
this.getChildren().add(cb);
this.getChildren().add(additionalNodes);
this.getChildren().add(actionButton);
}
示例3: createNodeChooser
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
private Node createNodeChooser() {
ChoiceBox<NodeFactory> cb = new ChoiceBox<NodeFactory>();
cb.setId(NODE_CHOOSER_ID);
cb.getItems().addAll(ControlsFactory.filteredValues());
/*
* Remove image view and media view
*/
cb.getItems().removeAll(ControlsFactory.ImageView, ControlsFactory.MediaView);
cb.getItems().addAll(Shapes.values());
cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<NodeFactory>() {
@Override
public void changed(ObservableValue<? extends NodeFactory> ov, NodeFactory t, NodeFactory t1) {
final Node node = t1.createNode();
node.setId(TESTED_CONTROL_ID);
spaceForNode.getChildren().clear();
spaceForNode.getChildren().add(node);
propertiesTable = new PropertiesTable(node);
propertiesTable.addBooleanPropertyLine(node.disableProperty());
propertiesTable.addDoublePropertyLine(node.opacityProperty(), 0, 1, 1);
propertiesTable.addSimpleListener(node.focusedProperty(), node);
propertiesPane.getChildren().clear();
propertiesPane.getChildren().add(propertiesTable);
}
});
VBox vb = new VBox(5);
vb.getChildren().addAll(new Label("Choose tested control : "), cb);
return vb;
}
示例4: createNodeChooser
import javafx.scene.control.ChoiceBox; //导入方法依赖的package包/类
private Node createNodeChooser() {
VBox vb = new VBox(5);
ChoiceBox<NodeFactory> cb = new ChoiceBox<NodeFactory>();
cb.setId(NODE_CHOOSER_ID);
cb.getItems().addAll(ControlsFactory.values());
cb.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<NodeFactory>() {
@Override
public void changed(ObservableValue<? extends NodeFactory> ov, NodeFactory t, NodeFactory t1) {
final Node createNode = t1.createNode();
if (createNode instanceof Control) {
currentlySelectedControl = (Control) createNode;
currentlySelectedControl.setId(SELECTED_NODE_ID);
currentlySelectedControl.setMinSize(controlSize, controlSize);
currentlySelectedControl.setPrefSize(controlSize, controlSize);
currentlySelectedControl.setMaxSize(controlSize, controlSize);
newControlPane.getChildren().clear();
newControlPane.getChildren().add(currentlySelectedControl);
} else {
System.out.println("Nothing");
}
}
});
vb.getChildren().addAll(new Label("Choose tested control : "), cb);
return vb;
}