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


Java RadioButton.setSelected方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: selectRadioBottonSelectedSelected

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
@Test public void selectRadioBottonSelectedSelected() {
    RadioButton radioButtonNode = (RadioButton) getPrimaryStage().getScene().getRoot().lookup(".radio-button");
    radioButtonNode.setSelected(true);
    AssertJUnit.assertEquals(true, radioButtonNode.isSelected());
    radioButton.marathon_select("true");
    new Wait("Waiting for the radio button selection.") {
        @Override public boolean until() {
            return radioButtonNode.isSelected();
        }
    };
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:12,代碼來源:JavaFXToggleButtonElementTest.java

示例10: rb

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
protected RadioButton rb(String text, boolean selected, boolean disabled)
{
	RadioButton b = new RadioButton(text);
	b.setSelected(selected);
	b.setDisable(disabled);
	return b;
}
 
開發者ID:andy-goryachev,項目名稱:FxEditor,代碼行數:8,代碼來源:PreferencesDialog.java

示例11: initBack

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private Pane initBack(final FlipPanel flipPanel, final StackPane FRONT_PANEL) {
    Region backButton = new Region();
    backButton.getStyleClass().add("back-button");
    backButton.addEventHandler(MouseEvent.MOUSE_CLICKED, EVENT -> flipPanel.flipToFront());

    ToggleGroup group = new ToggleGroup();

    final RadioButton standardGreen = new RadioButton("Green");
    standardGreen.setToggleGroup(group);
    standardGreen.setSelected(true);
    standardGreen.setOnAction(event -> FRONT_PANEL.setBackground(new Background(new BackgroundFill(Color.GREEN, CornerRadii.EMPTY, Insets.EMPTY))));

    final RadioButton amber         = new RadioButton("Red");
    amber.setToggleGroup(group);
    amber.setOnAction(event -> FRONT_PANEL.setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY))));

    final RadioButton blueDarkBlue  = new RadioButton("Blue");
    blueDarkBlue.setToggleGroup(group);
    blueDarkBlue.setOnAction(event -> FRONT_PANEL.setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY))));

    VBox componentsBack = new VBox(backButton, standardGreen, amber, blueDarkBlue);
    componentsBack.setSpacing(10);

    StackPane back = new StackPane();
    back.setPadding(new Insets(20, 20, 20, 20));
    back.getStyleClass().add("panel");
    back.getChildren().addAll(componentsBack);
    return back;
}
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:30,代碼來源:Demo.java

示例12: createXPathVersionPanel

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private javafx.scene.Node createXPathVersionPanel() {

		HBox p = new HBox(5);
		p.setPadding(new Insets(5, 5, 5, 5));
		//		JPanel p = new JPanel();
		Label e = new Label("XPath Version:");
		e.setAlignment(Pos.CENTER_LEFT);
		p.add(e);
		for (Object[] values : XPathRule.VERSION_DESCRIPTOR.choices()) {
			//			JRadioButton b = new JRadioButton();
			RadioButton b = new RadioButton((String) values[0]);

			//			b.setText((String) values[0]);
			b.setUserData(b.getText());
			//			b.setActionCommand(b.getText());
			if (values[0].equals(XPathRule.VERSION_DESCRIPTOR.defaultValue())) {
				b.setSelected(true);
			}
			b.setToggleGroup(xpathVersionButtonGroup);
			//			xpathVersionButtonGroup.add(b);
			p.add(b);
		}

		//		SwingNode swingNode = new SwingNode();
		//		createSwingContent(swingNode, p);
		return p;
	}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:28,代碼來源:DesignerFx.java

示例13: createRadioButtons

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
private void createRadioButtons(Group root) {
	toggleGroup = new ToggleGroup();
	red = new RadioButton("Red");
	red.setLayoutX(4 * HEX_SIDE);
	red.setLayoutY(HEIGHT - 4 * HEX_SIDE + 10);
	red.setToggleGroup(toggleGroup);
	red.setSelected(true);
	root.getChildren().add(red);
	red.setOnMouseClicked(event -> {
		this.color='R';
	});
	
	yellow = new RadioButton("Yellow");
	yellow.setLayoutX(4 * HEX_SIDE);
	yellow.setLayoutY(HEIGHT - 3 * HEX_SIDE);
	yellow.setToggleGroup(toggleGroup);
	root.getChildren().add(yellow);
	yellow.setOnMouseClicked(event -> {
		this.color='Y';
	});
	
	green = new RadioButton("Green");
	green.setLayoutX(4 * HEX_SIDE);
	green.setLayoutY(HEIGHT - 2 * HEX_SIDE - 10);
	green.setToggleGroup(toggleGroup);
	root.getChildren().add(green);
	green.setOnMouseClicked(event -> {
		this.color='G';
	});

}
 
開發者ID:sshubhadeep,項目名稱:Tantrix,代碼行數:32,代碼來源:GameGUI.java

示例14: 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");
	  
	  RadioButton rbGreedyTSP = new RadioButton("GreedyTSP");
	  rbGreedyTSP.setUserData("GreedyTSP");
	  
	  RadioButton rbGreedy2OptTSP = new RadioButton("Greedy2OptTSP");
	  rbGreedy2OptTSP.setUserData("Greedy2OptTSP");
	  

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

示例15: ProxySetting

import javafx.scene.control.RadioButton; //導入方法依賴的package包/類
ProxySetting() {
  final Preferences pref = Preferences.userNodeForPackage(GameRunner.class);
  final HttpProxy.ProxyChoice proxyChoice =
      HttpProxy.ProxyChoice.valueOf(pref.get(HttpProxy.PROXY_CHOICE, HttpProxy.ProxyChoice.NONE.toString()));
  noneButton = new RadioButton("None");
  noneButton.setSelected(proxyChoice == HttpProxy.ProxyChoice.NONE);
  systemButton = new RadioButton("Use System Settings");
  systemButton.setSelected(proxyChoice == HttpProxy.ProxyChoice.USE_SYSTEM_SETTINGS);

  userButton = new RadioButton("Use These Settings:");
  userButton.setSelected(proxyChoice == HttpProxy.ProxyChoice.USE_USER_PREFERENCES);
  hostText = new TextField(ClientSetting.PROXY_HOST.value());
  portText = new TextField(ClientSetting.PROXY_PORT.value());
  final VBox radioPanel = new VBox();
  radioPanel.getChildren().addAll(
      noneButton,
      systemButton,
      userButton,
      new Label("Proxy Host: "),
      hostText,
      new Label("Proxy Port: "),
      portText);
  hostText.disableProperty().bind(Bindings.not(userButton.selectedProperty()));
  portText.disableProperty().bind(Bindings.not(userButton.selectedProperty()));

  final ToggleGroup toggleGroup = new ToggleGroup();
  noneButton.setToggleGroup(toggleGroup);
  systemButton.setToggleGroup(toggleGroup);
  userButton.setToggleGroup(toggleGroup);
  getChildren().add(radioPanel);
}
 
開發者ID:triplea-game,項目名稱:triplea,代碼行數:32,代碼來源:JavaFxSelectionComponentFactory.java


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