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;
}
}
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);
}
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;
}
}
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);
}
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());
}
Aggregations