本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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));
}
示例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));
}
示例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");
}
示例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);
}
示例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);
}
示例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();
}
};
}
示例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;
}
示例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;
}
示例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;
}
示例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';
});
}
示例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) );
}
示例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);
}