use of com.jfoenix.controls.JFXToggleNode in project JFoenix by jfoenixadmin.
the class ToggleButtonDemo method start.
@Override
public void start(Stage stage) throws Exception {
final VBox pane = new VBox();
pane.setSpacing(30);
pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;");
ToggleButton button = new ToggleButton("JavaFx Toggle");
pane.getChildren().add(button);
JFXToggleButton toggleButton = new JFXToggleButton();
toggleButton.setText("New Skin");
pane.getChildren().add(toggleButton);
JFXToggleNode node = new JFXToggleNode();
node.setStyle("-fx-padding: 10");
node.setGraphic(new FontIcon(FontAwesomeSolid.HEART));
pane.getChildren().add(node);
final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE"));
stage.setTitle("JFX Toggle Button Demo ");
scene.getStylesheets().add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}
use of com.jfoenix.controls.JFXToggleNode in project JFoenix by jfoenixadmin.
the class JFXToggleNodeSkin method updateSelectionBackground.
public void updateSelectionBackground() {
CornerRadii radii = getSkinnable().getBackground() == null ? CornerRadii.EMPTY : getSkinnable().getBackground().getFills().get(0).getRadii();
Insets insets = getSkinnable().getBackground() == null ? Insets.EMPTY : getSkinnable().getBackground().getFills().get(0).getInsets();
selectionOverLay.setBackground(new Background(new BackgroundFill(getSkinnable().isSelected() ? ((JFXToggleNode) getSkinnable()).getSelectedColor() : ((JFXToggleNode) getSkinnable()).getUnSelectedColor(), radii, insets)));
}
Aggregations