本文整理汇总了Java中com.jfoenix.controls.JFXButton.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JFXButton.setBackground方法的具体用法?Java JFXButton.setBackground怎么用?Java JFXButton.setBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jfoenix.controls.JFXButton
的用法示例。
在下文中一共展示了JFXButton.setBackground方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MDRoundButtonSkin
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
public MDRoundButtonSkin(JFXButton button)
{
super(button);
this.buttonRippler = new JFXRippler(new StackPane(), RipplerMask.CIRCLE, RipplerPos.FRONT)
{
@Override
protected void initListeners()
{
this.ripplerPane.setOnMousePressed((event) -> {
this.createRipple(event.getX(), event.getY());
});
}
};
this.buttonContainer.getChildren().add(this.buttonRippler);
button.buttonTypeProperty().addListener((o, oldVal, newVal) -> this.updateButtonType(newVal));
button.setOnMousePressed((e) -> {
if(this.clickedAnimation != null)
{
this.clickedAnimation.setRate(1);
this.clickedAnimation.play();
}
});
button.setOnMouseReleased((e) -> {
if(this.clickedAnimation != null)
{
this.clickedAnimation.setRate(-1);
this.clickedAnimation.play();
}
});
button.setPickOnBounds(false);
this.buttonContainer.setPickOnBounds(false);
this.buttonContainer.borderProperty().bind(this.getSkinnable().borderProperty());
this.buttonContainer.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
if(button.getBackground() == null || this.isJavaDefaultBackground(button.getBackground()) || this.isJavaDefaultClickedBackground(button.getBackground()))
button.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, this.defaultRadii, null)));
if(this.getSkinnable().getBackground() != null && this.getSkinnable().getBackground().getFills().get(0).getInsets().equals(new Insets(-0.2, -0.2, -0.2, -0.2)))
return new Background(new BackgroundFill(this.getSkinnable().getBackground() != null ? this.getSkinnable().getBackground().getFills().get(0).getFill() : Color.TRANSPARENT, this.getSkinnable().backgroundProperty().get() != null ? this.getSkinnable().getBackground().getFills().get(0).getRadii() : this.defaultRadii, Insets.EMPTY));
else
return new Background(new BackgroundFill(this.getSkinnable().getBackground() != null ? this.getSkinnable().getBackground().getFills().get(0).getFill() : Color.TRANSPARENT, this.getSkinnable().getBackground() != null ? this.getSkinnable().getBackground().getFills().get(0).getRadii() : this.defaultRadii, Insets.EMPTY));
}, this.getSkinnable().backgroundProperty()));
button.ripplerFillProperty().addListener((o, oldVal, newVal) -> this.buttonRippler.setRipplerFill(newVal));
if(button.getBackground() == null || this.isJavaDefaultBackground(button.getBackground()))
button.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, this.defaultRadii, null)));
this.updateButtonType(button.getButtonType());
this.updateChildren();
}
示例2: createCalendarArrowsPane
import com.jfoenix.controls.JFXButton; //导入方法依赖的package包/类
protected BorderPane createCalendarArrowsPane() {
SVGGlyph leftChevron = new SVGGlyph(0,
"CHEVRON_LEFT",
"M 742,-37 90,614 Q 53,651 53,704.5 53,758 90,795 l 652,651 q 37,37 90.5,37 53.5,0 90.5,-37 l 75,-75 q 37,-37 37,-90.5 0,-53.5 -37,-90.5 L 512,704 998,219 q 37,-38 37,-91 0,-53 -37,-90 L 923,-37 Q 886,-74 832.5,-74 779,-74 742,-37 z",
Color.GRAY);
SVGGlyph rightChevron = new SVGGlyph(0,
"CHEVRON_RIGHT",
"m 1099,704 q 0,-52 -37,-91 L 410,-38 q -37,-37 -90,-37 -53,0 -90,37 l -76,75 q -37,39 -37,91 0,53 37,90 l 486,486 -486,485 q -37,39 -37,91 0,53 37,90 l 76,75 q 36,38 90,38 54,0 90,-38 l 652,-651 q 37,-37 37,-90 z",
Color.GRAY);
leftChevron.setFill(DEFAULT_COLOR);
leftChevron.setSize(6, 11);
rightChevron.setFill(DEFAULT_COLOR);
rightChevron.setSize(6, 11);
backMonthButton = new JFXButton();
backMonthButton.setMinSize(40, 40);
backMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
new CornerRadii(40),
Insets.EMPTY)));
backMonthButton.getStyleClass().add("left-button");
backMonthButton.setGraphic(leftChevron);
backMonthButton.setRipplerFill(this.datePicker.getDefaultColor());
backMonthButton.setOnAction(t -> forward(-1, MONTHS, false, true));
forwardMonthButton = new JFXButton();
forwardMonthButton.setMinSize(40, 40);
forwardMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
new CornerRadii(40),
Insets.EMPTY)));
forwardMonthButton.getStyleClass().add("right-button");
forwardMonthButton.setGraphic(rightChevron);
forwardMonthButton.setRipplerFill(this.datePicker.getDefaultColor());
forwardMonthButton.setOnAction(t -> forward(1, MONTHS, false, true));
BorderPane arrowsContainer = new BorderPane();
arrowsContainer.setLeft(backMonthButton);
arrowsContainer.setRight(forwardMonthButton);
arrowsContainer.setPadding(new Insets(4, 12, 2, 12));
arrowsContainer.setPickOnBounds(false);
return arrowsContainer;
}