当前位置: 首页>>代码示例>>Java>>正文


Java JFXRadioButton类代码示例

本文整理汇总了Java中com.jfoenix.controls.JFXRadioButton的典型用法代码示例。如果您正苦于以下问题:Java JFXRadioButton类的具体用法?Java JFXRadioButton怎么用?Java JFXRadioButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JFXRadioButton类属于com.jfoenix.controls包,在下文中一共展示了JFXRadioButton类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: commitCrime

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
@FXML
void commitCrime(ActionEvent event) {

    crimeBtn.setDisable(true);

    JFXRadioButton selectedRadio = (JFXRadioButton) group.getSelectedToggle();
    String extractedCrime = selectedRadio.getText();
    /*
    Extract the selected crime from the selected radio button's text or bindIt and pass it to the GameEngine. */
    GameEngine.game().isSuccessful(extractedCrime);

    Timeline timeline = new Timeline();
    for (int i = 0; i <= seconds; i++) {
        final int timeRemaining = seconds - i;
        KeyFrame frame = new KeyFrame(Duration.seconds(i),
                e -> {
                    crimeBtn.setDisable(true);
                    crimeBtn.setText("Wait " + timeRemaining + " sec..");
                });
        timeline.getKeyFrames().add(frame);
    }
    timeline.setOnFinished(e -> {
        crimeBtn.setText("Commit!");
        crimeBtn.setDisable(false);
        refresh();
        seconds += 5;
    });
    timeline.play();
}
 
开发者ID:gokcan,项目名称:Mafia-TCoS-CS319-Group2A,代码行数:30,代码来源:CrimeScene.java

示例2: buyClicked

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
public void buyClicked(MouseEvent mouseEvent) {
    JFXButton button = (JFXButton) mouseEvent.getSource();
    JFXRadioButton selectedRadio = (JFXRadioButton)group.getSelectedToggle();
    String launderingTool = selectedRadio.getText();
    if ((button).getText().equals("Buy!")){
        for(int i = 0; i < crimeSize; i++)
        {
            if(selectedRadio.getText().equals(GameEngine.getCrimes.get(i).getDescription()))
            {
                GameEngine.purchaseAsset(GameEngine.getCrimes.get(i));
            }
        }
    }
}
 
开发者ID:gokcan,项目名称:Mafia-TCoS-CS319-Group2A,代码行数:15,代码来源:LaunderingController.java

示例3: addToggleGroup

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
/**
 * Add an enumeration of options to a wizard step. Multiple RadioButtons
 * will be used (horizontally-aligned).
 *
 * @param fieldName
 * @param options
 *            list of choices.
 * @param prompt
 *            the text to show on the buttons tooltip.
 * @param defaultValue
 *            the default value to be selected.
 * @return
 */
@SuppressWarnings("unchecked")
public WizardStepBuilder addToggleGroup(final String fieldName, final String[] options, final String[] prompt,
        final int defaultValue)
{
    final ToggleGroup group = new ToggleGroup();

    final HBox box = new HBox();

    for (int i = 0; i < options.length; i++)
    {
        final JFXRadioButton radio = new JFXRadioButton(options[i]);
        radio.setPadding(new Insets(10));
        radio.setToggleGroup(group);
        radio.setTooltip(new Tooltip(prompt[i]));
        radio.setUserData(options[i]);
        if (i == defaultValue)
            radio.setSelected(true);

        box.getChildren().add(radio);
    }

    this.current.getData().put(fieldName, new ReadOnlyObjectWrapper<Toggle>());
    this.current.getData().get(fieldName).bind(group.selectedToggleProperty());
    final Label label = new Label(fieldName);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setHalignment(box, HPos.LEFT);
    this.current.add(label, 0, this.current.getData().size() - 1);
    this.current.add(box, 1, this.current.getData().size() - 1);
    return this;
}
 
开发者ID:Leviathan-Studio,项目名称:MineIDE,代码行数:44,代码来源:WizardStepBuilder.java

示例4: start

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) {
    final ToggleGroup group = new ToggleGroup();

    JFXRadioButton javaRadio = new JFXRadioButton("JavaFX");
    javaRadio.setPadding(new Insets(10));
    javaRadio.setToggleGroup(group);

    JFXRadioButton jfxRadio = new JFXRadioButton("JFoenix");
    jfxRadio.setPadding(new Insets(10));
    jfxRadio.setToggleGroup(group);


    VBox vbox = new VBox();
    vbox.getChildren().add(javaRadio);
    vbox.getChildren().add(jfxRadio);
    vbox.setSpacing(10);
    
    HBox hbox = new HBox();
    hbox.getChildren().add(vbox);
    hbox.setSpacing(50);
    hbox.setPadding(new Insets(40, 10, 10, 120));

    Scene scene = new Scene(hbox);
    primaryStage.setScene(scene);
    primaryStage.setWidth(500);
    primaryStage.setHeight(400);
    primaryStage.setTitle("JFX RadioButton Demo ");
    scene.getStylesheets()
        .add(RadioButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());

    primaryStage.show();
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:34,代码来源:RadioButtonDemo.java

示例5: initializeComponents

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
private void initializeComponents() {
    Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
    Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
    radio.setStroke(unSelectedColor);
    rippler.setRipplerFill(getSkinnable().isSelected() ? selectedColor : unSelectedColor);
    updateAnimation();
    playAnimation();
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:9,代码来源:JFXRadioButtonSkin.java

示例6: updateAnimation

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
private void updateAnimation() {
    Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
    Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
    timeline = new Timeline(
        new KeyFrame(Duration.ZERO,
            new KeyValue(dot.scaleXProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(dot.scaleYProperty(), 0, Interpolator.EASE_BOTH),
            new KeyValue(radio.strokeProperty(), unSelectedColor, Interpolator.EASE_BOTH)),

        new KeyFrame(Duration.millis(200),
            new KeyValue(dot.scaleXProperty(), 0.6, Interpolator.EASE_BOTH),
            new KeyValue(dot.scaleYProperty(), 0.6, Interpolator.EASE_BOTH),
            new KeyValue(radio.strokeProperty(), selectedColor, Interpolator.EASE_BOTH)));
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:15,代码来源:JFXRadioButtonSkin.java

示例7: optionClicked

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
public void optionClicked(MouseEvent mouseEvent) {
    JFXRadioButton button = (JFXRadioButton) mouseEvent.getSource();
    text = (button).getText();
}
 
开发者ID:gokcan,项目名称:Mafia-TCoS-CS319-Group2A,代码行数:5,代码来源:CarController.java

示例8: constructContentPane

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
/**
 * Constructs central part of stage.
 * Contains dynamical content.
 * @return main pane of the page containing all of the auctions
 */
@Override
public Pane constructContentPane() {

    //Panes
    BorderPane mainPane = new BorderPane();
    HBox filterPane = new HBox();
    JFXMasonryPane auctionPane = new JFXMasonryPane();
    //filterPane.setStyle();
    filterPane.setSpacing(10);

    //Fill filter option pane
    JFXRadioButton filterAll = new JFXRadioButton("All");
    JFXRadioButton filterPaintings = new JFXRadioButton("Paintings");
    JFXRadioButton filterSculptures = new JFXRadioButton("Sculptures");
    filterAll.setSelected(true);

    ToggleGroup filterGroup = new ToggleGroup();
    filterAll.setToggleGroup(filterGroup);
    filterPaintings.setToggleGroup(filterGroup);
    filterSculptures.setToggleGroup(filterGroup);

    //Is complete filter
    JFXCheckBox filterIsComplete = new JFXCheckBox("Hide completed");
    filterIsComplete.setSelected(hideCompleted);
    filterIsComplete.selectedProperty().addListener((observable, oldValue, newValue) -> {
        hideCompleted = newValue;
        fillAuctionPane(auctionPane, dc.filterAuctions(auctionKey, hideCompleted));
    });

    filterPane.getChildren().addAll(
            new Label("Filter auctions: "), filterAll, filterPaintings, filterSculptures, filterIsComplete
    );

    //Fill auction pane
    fillAuctionPane(auctionPane, dc.filterAuctions(AuctionFilterKey.ALL, hideCompleted));

    //Filter events
    filterAll.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            auctionKey = AuctionFilterKey.ALL;
            fillAuctionPane(auctionPane, dc.filterAuctions(auctionKey, hideCompleted));
        }
    });
    filterPaintings.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            auctionKey = AuctionFilterKey.PAINTING;
            fillAuctionPane(auctionPane, dc.filterAuctions(auctionKey, hideCompleted));
        }
    });
    filterSculptures.selectedProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue) {
            auctionKey = AuctionFilterKey.SCULPTURE;
            fillAuctionPane(auctionPane, dc.filterAuctions(auctionKey, hideCompleted));
        }
    });

    //Add panes to main pane
    mainPane.setTop(filterPane);
    mainPane.setCenter(auctionPane);

    BorderPane.setMargin(filterPane, new Insets(20,20,20,20));

    return  mainPane;
}
 
开发者ID:hadalhw17,项目名称:Artatawe,代码行数:70,代码来源:ArtworkContainer.java

示例9: initialize

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
@Override
	public void initialize(final URL location, final ResourceBundle __) {
		//areaLbl.setText(parkingAreaElement.getName());
//		new SelectAnArea().getAllPossibleColors().forEach(c -> {
//			final JFXRadioButton rbtn = new JFXRadioButton(
//					Character.toUpperCase(c.charAt(0)) + c.substring(1).toLowerCase());
//			radioHBox.getChildren().addAll(rbtn);
//			rbtn.setToggleGroup(group);
//			if (c == parkingAreaElement.getColor().name())
//				rbtn.setSelected(true);
//			selectedColor = parkingAreaElement.getColor().name();
//		});

		group.selectedToggleProperty().addListener((ChangeListener<Toggle>) (ov, prev, next) -> {
			if (group.getSelectedToggle() != null)
				selectedColor = ((JFXRadioButton) next.getToggleGroup().getSelectedToggle()).getText();
			System.out.println("Selected Radio Button - "
					+ ((JFXRadioButton) next.getToggleGroup().getSelectedToggle()).getText());
		});

		// Slider Initialization: Number of slots

		slotsField.valueProperty().bindBidirectional(slotsSlider.valueProperty());
		slotsField.setPrefWidth(45);
		slotsSlider.setMin(0);
		slotsSlider.setMax(250);
		slotsSlider.setValue(0);
		slotsInput.getChildren().add(slotsField);

		// Toggle switch initialization
		tempBp.setCenter(null);
		tempToggle.setOnAction(λ -> switchedOn.set(!switchedOn.get()));
		HBoxPrefHeight = 150.0d;
		switchedOn.addListener((listener, prev, next) -> {
			final Timeline timeline = new Timeline();
			if (next) {
				durationType = DurationType.TEMPORARY;
				tempHBox.setPrefHeight(0.0d);
				tempBp.setCenter(tempHBox);
				timeline.getKeyFrames().addAll(
						new KeyFrame(Duration.ZERO, new KeyValue(tempHBox.prefHeightProperty(), 0)), new KeyFrame(
								Duration.millis(300), new KeyValue(tempHBox.prefHeightProperty(), HBoxPrefHeight)));
				timeline.play();
			} else {
				durationType = DurationType.PERMANENTLY;
				tempBp.setCenter(tempHBox);
				timeline.getKeyFrames().addAll(
						new KeyFrame(Duration.ZERO, new KeyValue(tempHBox.prefHeightProperty(), HBoxPrefHeight)),
						new KeyFrame(Duration.millis(1), new KeyValue(tempHBox.prefHeightProperty(), 0)));
				timeline.play();
				timeline.setOnFinished(λ -> tempBp.setCenter(null));
			}
		});
	}
 
开发者ID:TechnionYP5777,项目名称:SmartCity-ParkingManagement,代码行数:55,代码来源:EditAreaController.java

示例10: setUpCrewPersonality

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
public void setUpCrewPersonality(int col) {
	// String n[] = new String[SIZE_OF_CREW];

	String quadrant1A = "Extravert", quadrant1B = "Introvert";
	String quadrant2A = "Intuition", quadrant2B = "Sensing";
	String quadrant3A = "Feeling", quadrant3B = "Thinking";
	String quadrant4A = "Judging", quadrant4B = "Perceiving";
	String cat1 = "Focus", cat2 = "Information", cat3 = "Decision", cat4 = "Structure";
	String a = null, b = null, c = null;

	VBox vbox = new VBox();

	for (int row = 0; row < 4; row++) {
		VBox options = new VBox();
		if (row == 0) {
			a = quadrant1A;
			b = quadrant1B;
			c = cat1;
		} else if (row == 1) {
			a = quadrant2A;
			b = quadrant2B;
			c = cat2;
		} else if (row == 2) {
			a = quadrant3A;
			b = quadrant3B;
			c = cat3;
		} else if (row == 3) {
			a = quadrant4A;
			b = quadrant4B;
			c = cat4;
		}

		JFXRadioButton ra = new JFXRadioButton(a);
		JFXRadioButton rb = new JFXRadioButton(b);
		ra.setUserData(a);
		rb.setUserData(b);

		if (personalityArray[row][col - 1])
			ra.setSelected(true);
		else
			rb.setSelected(true);

		final ToggleGroup group = new ToggleGroup();
		group.setUserData(c);
		ra.setToggleGroup(group);
		rb.setToggleGroup(group);

		final int r = row;
		group.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
			public void changed(ObservableValue<? extends Toggle> ov, Toggle old_toggle, Toggle new_toggle) {
				if (group.getSelectedToggle() != null) {
					String s = group.getSelectedToggle().getUserData().toString();
					// System.out.println(" selected : " + s);
					if (s.equals(quadrant1A) | s.equals(quadrant2A) | s.equals(quadrant3A) | s.equals(quadrant4A))
						personalityArray[r][col - 1] = true;
					else
						personalityArray[r][col - 1] = false;
				}
			}
		});

		options.getChildren().addAll(ra, rb);
		TitledPane titledPane = new TitledPane(c, options);
		// titledPane.setId("titledpane");
		titledPane.setPrefSize(100, 50);
		vbox.getChildren().add(titledPane);
	}

	gridPane.add(vbox, col, PERSONALITY_ROW); // personality's row = 5
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:71,代码来源:CrewEditorFX.java

示例11: JFXRadioButtonSkin

import com.jfoenix.controls.JFXRadioButton; //导入依赖的package包/类
public JFXRadioButtonSkin(JFXRadioButton control) {
    super(control);

    final double radioRadius = 7;
    radio = new Circle(radioRadius);
    radio.getStyleClass().setAll("radio");
    radio.setStrokeWidth(2);
    radio.setFill(Color.TRANSPARENT);

    dot = new Circle();
    dot.getStyleClass().setAll("dot");
    dot.setRadius(radioRadius);
    dot.fillProperty().bind(control.selectedColorProperty());
    dot.setScaleX(0);
    dot.setScaleY(0);

    StackPane boxContainer = new StackPane();
    boxContainer.getChildren().addAll(radio, dot);
    boxContainer.setPadding(new Insets(padding));
    rippler = new JFXRippler(boxContainer, RipplerMask.CIRCLE);
    container.getChildren().add(rippler);
    AnchorPane.setRightAnchor(rippler, labelOffset);
    updateChildren();

    // show focused state
    control.focusedProperty().addListener((o, oldVal, newVal) -> {
        if(!control.disableVisualFocusProperty().get()) {
            if (newVal) {
                if (!getSkinnable().isPressed()) {
                    rippler.setOverlayVisible(true);
                }
            } else {
                rippler.setOverlayVisible(false);
            }
        }
    });
    control.pressedProperty().addListener((o, oldVal, newVal) -> rippler.setOverlayVisible(false));

    registerChangeListener(control.selectedColorProperty(), "SELECTED_COLOR");
    registerChangeListener(control.unSelectedColorProperty(), "UNSELECTED_COLOR");
    registerChangeListener(control.selectedProperty(), "SELECTED");
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:43,代码来源:JFXRadioButtonSkin.java


注:本文中的com.jfoenix.controls.JFXRadioButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。