use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.
the class PromptLinesWrapper method updateUnfocusColor.
public void updateUnfocusColor() {
Paint paint = control.getUnFocusColor();
line.setBackground(paint == null ? Background.EMPTY : new Background(new BackgroundFill(paint, CornerRadii.EMPTY, Insets.EMPTY)));
}
use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.
the class JFXCheckBoxSkin method playIndeterminateAnimation.
private void playIndeterminateAnimation(Boolean indeterminate, boolean playAnimation) {
if (indeterminate == null) {
indeterminate = false;
}
indeterminateTransition.setRate(indeterminate ? 1 : -1);
if (playAnimation) {
indeterminateTransition.play();
} else {
if (indeterminate) {
CornerRadii radii = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getRadii();
Insets insets = indeterminateMark.getBackground() == null ? null : indeterminateMark.getBackground().getFills().get(0).getInsets();
indeterminateMark.setOpacity(1);
indeterminateMark.setScaleY(1);
indeterminateMark.setScaleX(1);
indeterminateMark.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
indeterminateTransition.playFrom(indeterminateTransition.getCycleDuration());
} else {
indeterminateMark.setOpacity(0);
indeterminateMark.setScaleY(0);
indeterminateMark.setScaleX(0);
indeterminateTransition.playFrom(Duration.ZERO);
}
}
if (getSkinnable().isSelected()) {
playSelectAnimation(!indeterminate, playAnimation);
}
}
use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.
the class JFXCheckBoxSkin method playSelectAnimation.
private void playSelectAnimation(Boolean selection, boolean playAnimation) {
if (selection == null) {
selection = false;
}
transition.setRate(selection ? 1 : -1);
select.setRate(selection ? 1 : -1);
if (playAnimation) {
transition.play();
select.play();
} else {
CornerRadii radii = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getRadii();
Insets insets = box.getBackground() == null ? null : box.getBackground().getFills().get(0).getInsets();
if (selection) {
mark.setScaleY(1);
mark.setScaleX(1);
mark.setOpacity(1);
box.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
select.playFrom(select.getCycleDuration());
transition.playFrom(transition.getCycleDuration());
} else {
mark.setScaleY(0);
mark.setScaleX(0);
mark.setOpacity(0);
box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, radii, insets)));
select.playFrom(Duration.ZERO);
transition.playFrom(Duration.ZERO);
}
}
box.setBorder(new Border(new BorderStroke(selection ? getSkinnable().getCheckedColor() : getSkinnable().getUnCheckedColor(), BorderStrokeStyle.SOLID, new CornerRadii(2), new BorderWidths(2))));
}
use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.
the class JFXColorPickerSkin method initColor.
private void initColor() {
final ColorPicker colorPicker = (ColorPicker) getSkinnable();
Color color = colorPicker.getValue();
Color circleColor = color == null ? Color.WHITE : color;
// update picker box color
colorBox.setBackground(new Background(new BackgroundFill(circleColor, new CornerRadii(3), Insets.EMPTY)));
// update label color
displayNode.setTextFill(circleColor.grayscale().getRed() < 0.5 ? Color.valueOf("rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)"));
if (colorLabelVisible.get()) {
displayNode.setText(JFXNodeUtils.colorToHex(circleColor));
} else {
displayNode.setText("");
}
}
use of javafx.scene.layout.Background in project JFoenix by jfoenixadmin.
the class JFXDialog method initialize.
private void initialize() {
this.setVisible(false);
this.getStyleClass().add(DEFAULT_STYLE_CLASS);
this.transitionType.addListener((o, oldVal, newVal) -> {
animation = getShowAnimation(transitionType.get());
});
contentHolder = new StackPane();
contentHolder.setBackground(new Background(new BackgroundFill(Color.WHITE, new CornerRadii(2), null)));
JFXDepthManager.setDepth(contentHolder, 4);
contentHolder.setPickOnBounds(false);
// ensure stackpane is never resized beyond it's preferred size
contentHolder.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
this.getChildren().add(contentHolder);
this.getStyleClass().add("jfx-dialog-overlay-pane");
StackPane.setAlignment(contentHolder, Pos.CENTER);
this.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 0, 0.1), null, null)));
// close the dialog if clicked on the overlay pane
if (overlayClose.get()) {
this.addEventHandler(MouseEvent.MOUSE_PRESSED, closeHandler);
}
// prevent propagating the events to overlay pane
contentHolder.addEventHandler(MouseEvent.ANY, e -> e.consume());
}
Aggregations