Search in sources :

Example 11 with RadioButton

use of javafx.scene.control.RadioButton in project FXGL by AlmasB.

the class InterpolatorSample method playAnimation.

private void playAnimation(EasingInterpolator interpolator) {
    set("canPlay", false);
    Interpolator ease = getEase(interpolator);
    String animType = ((RadioButton) group2.getSelectedToggle()).getText();
    switch(animType) {
        case "Translate":
            Entities.animationBuilder().interpolator(ease).duration(Duration.seconds(2.3)).onFinished(() -> set("canPlay", true)).translate(player).from(new Point2D(0, -150)).to(new Point2D(0, 300)).buildAndPlay();
            break;
        case "Scale":
            Entities.animationBuilder().interpolator(ease).autoReverse(true).repeat(2).duration(Duration.seconds(1.15)).onFinished(() -> set("canPlay", true)).scale(player).from(new Point2D(1, 1)).to(new Point2D(0, 0)).buildAndPlay();
            break;
        case "Rotate":
            Entities.animationBuilder().interpolator(ease).duration(Duration.seconds(2.3)).onFinished(() -> set("canPlay", true)).rotate(player).rotateFrom(0).rotateTo(360).buildAndPlay();
            break;
    }
}
Also used : Point2D(javafx.geometry.Point2D) EasingInterpolator(com.almasb.fxgl.animation.EasingInterpolator) Interpolator(javafx.animation.Interpolator) RadioButton(javafx.scene.control.RadioButton)

Example 12 with RadioButton

use of javafx.scene.control.RadioButton in project JFoenix by jfoenixadmin.

the class JFXRadioButtonSkin method layoutChildren.

@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    final RadioButton radioButton = getSkinnable();
    final double contWidth = snapSize(container.prefWidth(-1));
    final double contHeight = snapSize(container.prefHeight(-1));
    final double computeWidth = Math.max(radioButton.prefWidth(-1), radioButton.minWidth(-1));
    final double width = snapSize(contWidth);
    final double height = snapSize(contHeight);
    final double labelWidth = Math.min(computeWidth - contWidth, w - width);
    final double labelHeight = Math.min(radioButton.prefHeight(labelWidth), h);
    final double maxHeight = Math.max(contHeight, labelHeight);
    final double xOffset = computeXOffset(w, labelWidth + contWidth, radioButton.getAlignment().getHpos()) + x;
    final double yOffset = computeYOffset(h, maxHeight, radioButton.getAlignment().getVpos()) + x;
    container.resize(width, height);
    layoutLabelInArea(xOffset + contWidth + padding / 3, yOffset, labelWidth, maxHeight, radioButton.getAlignment());
    positionInArea(container, xOffset, yOffset, contWidth, maxHeight, 0, radioButton.getAlignment().getHpos(), radioButton.getAlignment().getVpos());
    final double ripplerWidth = width + 2 * padding;
    final double ripplerHeight = height + 2 * padding;
    rippler.resizeRelocate((width / 2 + xOffset) - ripplerWidth / 2, (height / 2 + xOffset) - ripplerHeight / 2, ripplerWidth, ripplerHeight);
}
Also used : JFXRadioButton(com.jfoenix.controls.JFXRadioButton) RadioButton(javafx.scene.control.RadioButton)

Example 13 with RadioButton

use of javafx.scene.control.RadioButton in project FXGL by AlmasB.

the class InterpolatorSample method playAnimation.

private void playAnimation(EasingInterpolator interpolator) {
    set("canPlay", false);
    Interpolator ease = getEase(interpolator);
    String animType = ((RadioButton) group2.getSelectedToggle()).getText();
    switch(animType) {
        case "Translate":
            animationBuilder().interpolator(ease).duration(Duration.seconds(2.3)).onFinished(() -> set("canPlay", true)).translate(player).from(new Point2D(200, 0)).to(new Point2D(200, 250)).buildAndPlay();
            break;
        case "Scale":
            animationBuilder().interpolator(ease).autoReverse(true).repeat(2).duration(Duration.seconds(1.15)).onFinished(() -> set("canPlay", true)).scale(player).from(new Point2D(1, 1)).to(new Point2D(0, 0)).buildAndPlay();
            break;
        case "Rotate":
            animationBuilder().interpolator(ease).duration(Duration.seconds(2.3)).onFinished(() -> set("canPlay", true)).rotate(player).from(0).to(360).buildAndPlay();
            break;
    }
}
Also used : Point2D(javafx.geometry.Point2D) EasingInterpolator(com.almasb.fxgl.animation.EasingInterpolator) Interpolator(javafx.animation.Interpolator) RadioButton(javafx.scene.control.RadioButton)

Example 14 with RadioButton

use of javafx.scene.control.RadioButton in project BTW by TechnionYearlyProject.

the class PrepareConfigsController method generateButtonClick.

public void generateButtonClick(ActionEvent actionEvent) {
    RadioButton selectedRadioButton = (RadioButton) generate_city_toggle.getSelectedToggle();
    if (selectedRadioButton == null)
        return;
    String switchTo;
    if (selectedRadioButton.equals(grid_radio)) {
        switchTo = "/fxml/generate_grid.fxml";
    } else if (selectedRadioButton.equals(free_form_radio)) {
        switchTo = "/fxml/generate_free_form.fxml";
    } else {
        return;
    }
    GenerateCityController.acceptAction = DrawMapController.AcceptAction.SaveMap;
    switchScreens(actionEvent, switchTo);
}
Also used : RadioButton(javafx.scene.control.RadioButton)

Example 15 with RadioButton

use of javafx.scene.control.RadioButton in project JFoenix by jfoenixadmin.

the class JFXRadioButtonOldSkin method layoutChildren.

@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    final RadioButton radioButton = getSkinnable();
    contWidth = snapSize(container.prefWidth(-1)) + (invalid ? 2 : 0);
    contHeight = snapSize(container.prefHeight(-1)) + (invalid ? 2 : 0);
    final double computeWidth = Math.min(radioButton.prefWidth(-1), radioButton.minWidth(-1)) + labelOffset + 2 * padding;
    final double labelWidth = Math.min(computeWidth - contWidth, w - snapSize(contWidth)) + labelOffset + 2 * padding;
    final double labelHeight = Math.min(radioButton.prefHeight(labelWidth), h);
    maxHeight = Math.max(contHeight, labelHeight);
    final double xOffset = computeXOffset(w, labelWidth + contWidth, radioButton.getAlignment().getHpos()) + x;
    final double yOffset = computeYOffset(h, maxHeight, radioButton.getAlignment().getVpos()) + x;
    if (invalid) {
        initializeComponents(x, y, w, h);
        invalid = false;
    }
    layoutLabelInArea(xOffset + contWidth, yOffset, labelWidth, maxHeight, radioButton.getAlignment());
    ((Text) getChildren().get(0)).textProperty().set(getSkinnable().textProperty().get());
    container.resize(snapSize(contWidth), snapSize(contHeight));
    positionInArea(container, xOffset, yOffset, contWidth, maxHeight, 0, radioButton.getAlignment().getHpos(), radioButton.getAlignment().getVpos());
}
Also used : RadioButton(javafx.scene.control.RadioButton)

Aggregations

RadioButton (javafx.scene.control.RadioButton)29 Insets (javafx.geometry.Insets)9 ToggleGroup (javafx.scene.control.ToggleGroup)8 Label (javafx.scene.control.Label)7 Button (javafx.scene.control.Button)5 HBox (javafx.scene.layout.HBox)5 VBox (javafx.scene.layout.VBox)5 EasingInterpolator (com.almasb.fxgl.animation.EasingInterpolator)4 JFXRadioButton (com.jfoenix.controls.JFXRadioButton)4 AutoTooltipRadioButton (bisq.desktop.components.AutoTooltipRadioButton)3 ObservableValue (javafx.beans.value.ObservableValue)3 ActionEvent (javafx.event.ActionEvent)3 Node (javafx.scene.Node)3 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)2 RequiredFieldValidator (com.jfoenix.validation.RequiredFieldValidator)2 FontAwesomeIconView (de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView)2 ArrayList (java.util.ArrayList)2 Interpolator (javafx.animation.Interpolator)2 FXCollections (javafx.collections.FXCollections)2 ObservableList (javafx.collections.ObservableList)2