use of com.jfoenix.controls.JFXRadioButton in project JFoenix by jfoenixadmin.
the class JFXRadioButtonSkin method updateAnimation.
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)));
}
use of com.jfoenix.controls.JFXRadioButton in project JFoenix by jfoenixadmin.
the class JFXRadioButtonSkin method initializeComponents.
private void initializeComponents(final double x, final double y, final double w, final double h) {
Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
radio.setStroke(unSelectedColor);
rippler.setRipplerFill(getSkinnable().isSelected() ? selectedColor : unSelectedColor);
updateAnimation();
playAnimation();
}
use of com.jfoenix.controls.JFXRadioButton in project JFoenix by jfoenixadmin.
the class RadioButtonDemo method start.
@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();
}
use of com.jfoenix.controls.JFXRadioButton in project JFoenix by jfoenixadmin.
the class JFXRadioButtonSkin method updateColors.
private void updateColors() {
boolean isSelected = getSkinnable().isSelected();
Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
rippler.setRipplerFill(isSelected ? selectedColor : unSelectedColor);
radio.setStroke(isSelected ? selectedColor : unSelectedColor);
}
use of com.jfoenix.controls.JFXRadioButton in project JFoenix by jfoenixadmin.
the class JFXRadioButtonSkin method handleControlPropertyChanged.
@Override
protected void handleControlPropertyChanged(String p) {
super.handleControlPropertyChanged(p);
if ("SELECTED_COLOR".equals(p)) {
// update current colors
updateColors();
} else if ("UNSELECTED_COLOR".equals(p)) {
// update current colors
updateColors();
} else if ("SELECTED".equals(p)) {
// update ripple color
boolean isSelected = getSkinnable().isSelected();
Color unSelectedColor = ((JFXRadioButton) getSkinnable()).getUnSelectedColor();
Color selectedColor = ((JFXRadioButton) getSkinnable()).getSelectedColor();
rippler.setRipplerFill(isSelected ? selectedColor : unSelectedColor);
if (((JFXRadioButton) getSkinnable()).isDisableAnimation()) {
// apply end values
timer.applyEndValues();
} else {
// play selection animation
timer.reverseAndContinue();
}
}
}
Aggregations