Search in sources :

Example 1 with JFXCheckBox

use of com.jfoenix.controls.JFXCheckBox in project JFoenix by jfoenixadmin.

the class CheckBoxDemo method start.

@Override
public void start(Stage stage) {
    FlowPane main = new FlowPane();
    main.setVgap(20);
    main.setHgap(20);
    CheckBox cb = new CheckBox("CheckBox");
    JFXCheckBox jfxCheckBox = new JFXCheckBox("JFX CheckBox");
    JFXCheckBox customJFXCheckBox = new JFXCheckBox("JFX CheckBox");
    customJFXCheckBox.getStyleClass().add("custom-jfx-check-box");
    main.getChildren().add(cb);
    main.getChildren().add(jfxCheckBox);
    main.getChildren().add(customJFXCheckBox);
    StackPane pane = new StackPane();
    pane.getChildren().add(main);
    StackPane.setMargin(main, new Insets(100));
    pane.setStyle("-fx-background-color:WHITE");
    final Scene scene = new Scene(pane, 600, 200);
    scene.getStylesheets().add(CheckBoxDemo.class.getResource("/resources/css/jfoenix-components.css").toExternalForm());
    stage.setTitle("JFX CheckBox Demo ");
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();
}
Also used : Insets(javafx.geometry.Insets) JFXCheckBox(com.jfoenix.controls.JFXCheckBox) JFXCheckBox(com.jfoenix.controls.JFXCheckBox) CheckBox(javafx.scene.control.CheckBox) FlowPane(javafx.scene.layout.FlowPane) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Example 2 with JFXCheckBox

use of com.jfoenix.controls.JFXCheckBox in project JFoenix by jfoenixadmin.

the class JFXCheckBoxSkin method playSelectAnimation.

private void playSelectAnimation(Boolean selection) {
    if (selection == null)
        selection = false;
    JFXCheckBox control = ((JFXCheckBox) getSkinnable());
    transition.setRate(selection ? 1 : -1);
    select.setRate(selection ? 1 : -1);
    transition.play();
    select.play();
    box.setBorder(new Border(new BorderStroke(selection ? control.getCheckedColor() : control.getUnCheckedColor(), BorderStrokeStyle.SOLID, new CornerRadii(2), new BorderWidths(lineThick))));
}
Also used : JFXCheckBox(com.jfoenix.controls.JFXCheckBox)

Aggregations

JFXCheckBox (com.jfoenix.controls.JFXCheckBox)2 Insets (javafx.geometry.Insets)1 Scene (javafx.scene.Scene)1 CheckBox (javafx.scene.control.CheckBox)1 FlowPane (javafx.scene.layout.FlowPane)1 StackPane (javafx.scene.layout.StackPane)1