當前位置: 首頁>>代碼示例>>Java>>正文


Java ChoiceBox.setId方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:20,代碼來源:ObjectPropertyValueSetter.java

示例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);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:29,代碼來源:NodesChoserFactory.java

示例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;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:35,代碼來源:ControlChooserApp.java

示例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;
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:30,代碼來源:ControlsSkinsApp.java


注:本文中的javafx.scene.control.ChoiceBox.setId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。