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


Java RadioButton.setToggleGroup方法代碼示例

本文整理匯總了Java中javafx.scene.control.RadioButton.setToggleGroup方法的典型用法代碼示例。如果您正苦於以下問題:Java RadioButton.setToggleGroup方法的具體用法?Java RadioButton.setToggleGroup怎麽用?Java RadioButton.setToggleGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.RadioButton的用法示例。


在下文中一共展示了RadioButton.setToggleGroup方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createRadioButton

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private RadioButton createRadioButton(final Node rect, String name, final boolean toFront, ToggleGroup tg) {
    final RadioButton radioButton = new RadioButton(name);
    radioButton.setToggleGroup(tg);
    radioButton.selectedProperty().addListener(new InvalidationListener() {
        public void invalidated(Observable ov) {
            if (radioButton.isSelected()) {
                if (toFront) {
                    rect.toFront();
                } else {
                    rect.toBack();
                }
            }
        }
    });

    return radioButton;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:NodePropertiesSample.java

示例2: RadioButtons

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
public RadioButtons() {
    super(400,100);
    ToggleGroup tg = new ToggleGroup();
    VBox vbox = new VBox();
    vbox.setSpacing(5);
    RadioButton rb1 = new RadioButton("Hello");
    rb1.setToggleGroup(tg);

    RadioButton rb2 = new RadioButton("Bye");
    rb2.setToggleGroup(tg);
    rb2.setSelected(true);

    RadioButton rb3 = new RadioButton("Disabled");
    rb3.setToggleGroup(tg);
    rb3.setSelected(false);
    rb3.setDisable(true);

    vbox.getChildren().add(rb1);
    vbox.getChildren().add(rb2);
    vbox.getChildren().add(rb3);
    getChildren().add(vbox);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:23,代碼來源:RadioButtons.java

示例3: createButtonGroup

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
/**
 * Create a radio button for each String in the list, add them to the container, and bind the selected value to the
 * String property
 *
 * @param container     Container to put radio buttons in
 * @param radioBtns     List of Strings, one for each radio button
 * @param modelProperty Property to bind selected radio button's value to
 */
public static ToggleGroupValue createButtonGroup(Pane container, List<String> radioBtns, StringProperty modelProperty) {
    // Create new ToggleGroup and ToggleGroupValue for the radio buttons
    ToggleGroupValue groupValue = new ToggleGroupValue();
    ToggleGroup btnsGroup = new ToggleGroup();

    // Create a radio button for each option
    for (String s : radioBtns) {
        // Create radio button for this option
        RadioButton radioBtn = new RadioButton(s);
        radioBtn.setUserData(s);
        radioBtn.setToggleGroup(btnsGroup);

        // Add to RadioButton to the container pane and the ToggleGroupValue
        container.getChildren().add(radioBtn);
        groupValue.add(radioBtn, radioBtn.getUserData());
    }

    // Bind toggle group value to model
    modelProperty.bindBidirectional(groupValue.valueProperty());

    // Select first option
    groupValue.setValue(radioBtns.get(0));

    return groupValue;
}
 
開發者ID:scify,項目名稱:jedai-ui,代碼行數:34,代碼來源:RadioButtonHelper.java

示例4: makeDataSelector

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
/**
 * Data selector between VoogaBoolean and VoogaNumber.
 * @return
 */
private HBox makeDataSelector () {
	ToggleGroup group = new ToggleGroup();
	RadioButton number = new RadioButton("Number");
	number.setToggleGroup(group);
	number.setSelected(true);
	RadioButton bool = new RadioButton("Boolean");
	bool.setToggleGroup(group);
	number.selectedProperty().addListener( (obs, old, newVal) -> {
		container.getChildren().remove(buttons);
		if (newVal) {
			container.getChildren().add(numberSelector);
			container.getChildren().remove(boolSelector);
			chosenData = VOOGA_NUMBER;
		}
		else {
			container.getChildren().remove(numberSelector);
			container.getChildren().add(boolSelector);
			chosenData = VOOGA_BOOLEAN;
		}
		container.getChildren().add(buttons);
	});
	return GUIUtils.makeRow(number, bool);
}
 
開發者ID:sjain28,項目名稱:Game-Engine-Vooga,代碼行數:28,代碼來源:PropertyBuilder.java

示例5: ItemListCell

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
ItemListCell() {
	hBox = new HBox();
	rd = new RadioButton();

	rd.setOnMouseClicked(ev -> {
		getListView().getItems().forEach(v -> v.setSelection(false));
		CodeItem codeItem = getListView().getItems().get(ItemListCell.this.getIndex());
		codeItem.setSelection(true);
		selectedItem.set(codeItem);
		rd.setSelected(true);
	});

	rd.setToggleGroup(value);
	label = new Label();
	hBox.getChildren().addAll(rd, label);
}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:17,代碼來源:InjectionItemListComposite.java

示例6: enumChoiceBox

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private <T extends Enum> VBox enumChoiceBox(final Class<T> enumClass, final Enum currentValue) {
    final T[] values = enumClass.getEnumConstants();
    
    final List<RadioButton> buttons = new ArrayList<>();
    final ToggleGroup toggleGroup = new ToggleGroup();
    for (T value : values) {
        final RadioButton button = new RadioButton(value.toString());
        button.setToggleGroup(toggleGroup);
        button.setSelected(value.equals(currentValue));
        
        buttons.add(button);
    }

    final VBox result = new VBox();
    result.setSpacing(10.0);
    result.getChildren().addAll(buttons);

    return result;
}
 
開發者ID:ThomasDaheim,項目名稱:GPXEditor,代碼行數:20,代碼來源:GPXPreferencesUI.java

示例7: setupToggle

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private LinkedList<RadioButton> setupToggle(ToggleGroup group) {

		// Use Dijkstra as default
		RadioButton rbD = new RadioButton("Dijkstra");
		rbD.setUserData("Dijkstra");
		rbD.setSelected(true);

		RadioButton rbA = new RadioButton("A*");
		rbA.setUserData("A*");

		RadioButton rbB = new RadioButton("BFS");
		rbB.setUserData("BFS");

		rbB.setToggleGroup(group);
		rbD.setToggleGroup(group);
		rbA.setToggleGroup(group);
		return new LinkedList<RadioButton>(Arrays.asList(rbB, rbD, rbA));
	}
 
開發者ID:Cs4r,項目名稱:UCSDGraphs,代碼行數:19,代碼來源:MapApp.java

示例8: ModeSelectorViewJfx

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
public ModeSelectorViewJfx() {
    hBox = new HBox(25);
    hBox.setMaxHeight(40);
    hBox.setAlignment(Pos.CENTER_LEFT);

    Label modeLabel = new Label("Mode:");
    hostButton = new RadioButton("Host");
    guestButton = new RadioButton("Guest");

    ToggleGroup toggleGroup = new ToggleGroup();
    hostButton.setToggleGroup(toggleGroup);
    guestButton.setToggleGroup(toggleGroup);

    HBox.setMargin(modeLabel, new Insets(0, 30, 0, 0));

    hBox.getChildren().addAll(modeLabel, hostButton, guestButton);
}
 
開發者ID:NoahAndrews,項目名稱:SynchronizedMediaPlayer,代碼行數:18,代碼來源:ModeSelectorViewJfx.java

示例9: setupToggle

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private LinkedList<RadioButton> setupToggle(ToggleGroup group) {

	  // Use Dijkstra as default
	  RadioButton rbD = new RadioButton("Dijkstra");
	  rbD.setUserData("Dijkstra");
	  rbD.setSelected(true);

	  RadioButton rbA = new RadioButton("A*");
	  rbA.setUserData("A*");

	  RadioButton rbB = new RadioButton("BFS");
	  rbB.setUserData("BFS");

	  rbB.setToggleGroup(group);
	  rbD.setToggleGroup(group);
	  rbA.setToggleGroup(group);
	  return new LinkedList<RadioButton>(Arrays.asList(rbB, rbD, rbA));
	}
 
開發者ID:MacSimmy,項目名稱:Maps,代碼行數:19,代碼來源:MapApp.java

示例10: initialize

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
@Override
public void initialize(URL location, ResourceBundle resources) {
    importer = new WebImporter();
    importMode = HtmlImportMode.ORIGINAL;

    ObservableList<Node> nodes = modesBox.getChildren();
    nodes.clear();
    final ToggleGroup modesGroup = new ToggleGroup();
    for (HtmlImportMode value : HtmlImportMode.values()) {
        RadioButton radio = new RadioButton(resources.getString(value.getName()));
        if (value == importMode)
            radio.setSelected(true);
        radio.setOnAction(e -> onModeChanged(value));
        radio.setToggleGroup(modesGroup);
        nodes.add(radio);
    }

    pagePreview.getEngine().loadContent(resources.getString("preview"), "text/html");
}
 
開發者ID:NoticEditorTeam,項目名稱:NoticEditor,代碼行數:20,代碼來源:WebImportController.java

示例11: initUI

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
@Override
protected void initUI() {
    VBox vbox = new VBox(5);

    for (EasingInterpolator interpolator : Interpolators.values()) {
        Button btn = new Button(interpolator.toString());
        btn.disableProperty().bind(getGameState().booleanProperty("canPlay").not());
        btn.setOnAction(e -> playAnimation(interpolator));

        vbox.getChildren().add(btn);
    }

    RadioButton btn1 = new RadioButton("Ease In");
    RadioButton btn2 = new RadioButton("Ease Out");
    RadioButton btn3 = new RadioButton("Ease In Out");
    btn1.setToggleGroup(group);
    btn2.setToggleGroup(group);
    btn3.setToggleGroup(group);
    btn2.setSelected(true);

    vbox.getChildren().addAll(btn1, btn2, btn3);

    vbox.setTranslateX(650);
    getGameScene().addUINode(vbox);
}
 
開發者ID:AlmasB,項目名稱:FXGL,代碼行數:26,代碼來源:InterpolatorSample.java

示例12: initSkipRadioButton

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private void initSkipRadioButton() {
	// Move all children down, first.
	for (Node child : getChildren()) {
		final Integer rowIndex = getRowIndex(child);
		assertNotNull(rowIndex, "rowIndex[" + child + "]");
		setRowIndex(child, rowIndex + 1);
	}

	// Then add the skipRadioButton as top-most child.
	skipRadioButton = new RadioButton();
	skipRadioButton.setText("Do NOT certify this key, now. Skip signing it!");
	skipRadioButton.setToggleGroup(toggleGroup);
	setMargin(skipRadioButton, new Insets(0, 0, 8, 0));
	add(skipRadioButton, 0, 0, 2, 1);

	skipRadioButton.selectedProperty().bindBidirectional(certifyPgpKeyData.skipProperty());
}
 
開發者ID:subshare,項目名稱:subshare,代碼行數:18,代碼來源:CertifyPgpKeyPane.java

示例13: MessageTypeDialog

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
public MessageTypeDialog() {
    super(null, "Choose message type", false, DialogStyle.NATIVE);
    setMasthead("Choose message type");

    group = new ToggleGroup();

    RadioButton textButton = new RadioButton("Text");
    textButton.setUserData(new JmsTextMessage());
    textButton.setToggleGroup(group);
    textButton.setSelected(true);
    RadioButton bytesButton = new RadioButton("Bytes");
    bytesButton.setUserData(new JmsBytesMessage());
    bytesButton.setToggleGroup(group);

    HBox hbox = new HBox(5);
    hbox.getChildren().add(textButton);
    hbox.getChildren().add(bytesButton);
    setContent(hbox);

    Action action = new JmsMessageAction();
    action.disabledProperty().bind(group.selectedToggleProperty().isNull());

    ButtonBar.setType(action, ButtonBar.ButtonType.OK_DONE);
    getActions().addAll(action, Dialog.Actions.CANCEL);
}
 
開發者ID:Mykolas-Molis,項目名稱:mq-visualizer,代碼行數:26,代碼來源:MessageTypeDialog.java

示例14: RadioButtonGroup

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
public RadioButtonGroup(T[] values) {
// Call default constructor
this();

final Insets PADDING = new Insets(2);

// Create a radio button for each selectedValue
int i = 0;
for (T value : values) {
    RadioButton button = new RadioButton(value.toString());
    button.setToggleGroup(group);
    button.setAlignment(Pos.CENTER_LEFT);
    // Add the button to the grid layout
    add(button, 0, i);
    GridPane.setMargin(button, PADDING);

    valueToButton.put(value, button);

    i++;
}
   }
 
開發者ID:samcrow,項目名稱:FrameViewer-AnTracks,代碼行數:22,代碼來源:RadioButtonGroup.java

示例15: PreferenceOutputPane

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
@Inject
public PreferenceOutputPane(@Named("smartRadio") PreferenceRadioButton smartRadio) {
    I18nContext i18n = DefaultI18nContext.getInstance();
    ToggleGroup group = new ToggleGroup();

    RadioButton manualRadio = new RadioButton(i18n.i18n("Manually selected"));
    manualRadio.setToggleGroup(group);
    manualRadio.getStyleClass().addAll(Style.VITEM.css());
    manualRadio.setId("manualRadio");

    smartRadio.getStyleClass().addAll(Style.VITEM.css());
    smartRadio.setToggleGroup(group);
    smartRadio.setGraphic(helpIcon(DefaultI18nContext.getInstance()
            .i18n("Automatically set the destination directory to the selected PDF document directory")));
    smartRadio.getStyleClass().addAll(Style.WITH_HELP.css());

    if (isNull(group.getSelectedToggle())) {
        group.selectToggle(manualRadio);
    }

    getChildren().addAll(manualRadio, smartRadio);
    getStyleClass().addAll(Style.CONTAINER.css());
}
 
開發者ID:torakiki,項目名稱:pdfsam,代碼行數:24,代碼來源:PreferenceOutputPane.java


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