本文整理了Java中javafx.scene.layout.BackgroundFill
类的一些代码示例,展示了BackgroundFill
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BackgroundFill
类的具体详情如下:
包路径:javafx.scene.layout.BackgroundFill
类名称:BackgroundFill
暂无
代码示例来源:origin: jfoenixadmin/JFoenix
public void updateUnfocusColor() {
Paint paint = control.getUnFocusColor();
line.setBackground(paint == null ? Background.EMPTY
: new Background(new BackgroundFill(paint, CornerRadii.EMPTY, Insets.EMPTY)));
}
代码示例来源:origin: jfoenixadmin/JFoenix
public static void updateBackground(Background newBackground, Region nodeToUpdate, Paint fill) {
if (newBackground != null && !newBackground.getFills().isEmpty()) {
final BackgroundFill[] fills = new BackgroundFill[newBackground.getFills().size()];
for (int i = 0; i < newBackground.getFills().size(); i++) {
BackgroundFill bf = newBackground.getFills().get(i);
fills[i] = new BackgroundFill(fill, bf.getRadii(), bf.getInsets());
}
nodeToUpdate.setBackground(new Background(fills));
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
paraTransition.setOnFinished((finish) -> {
tabsHeader.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
}, newVal.fillProperty()));
pane.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
}, newVal.fillProperty()));
});
Color fontColor = ((Color) newVal.getFills().get(0).getFill()).grayscale()
.getRed() > 0.5 ? Color.valueOf(
"rgba(40, 40, 40, 0.87)") : Color.valueOf("rgba(255, 255, 255, 0.87)");
((Pane) tabs.lookup(".tab-selected-line")).setBackground(new Background(new BackgroundFill(fontColor,CornerRadii.EMPTY,Insets.EMPTY)));
pickerDecorator.lookupAll(".jfx-decorator-button").forEach(button -> {
((JFXButton) button).setRipplerFill(fontColor);
Color newColor = (Color) newVal.getFills().get(0).getFill();
String hex = String.format("#%02X%02X%02X",
(int) (newColor.getRed() * 255),
pane.setBackground(new Background(new BackgroundFill(curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
CornerRadii.EMPTY,
Insets.EMPTY)));
((Region) tabs.lookup(".tab-header-background")).setBackground(new Background(new BackgroundFill(
curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
CornerRadii.EMPTY,
tabsHeader.backgroundProperty().unbind();
代码示例来源:origin: jfoenixadmin/JFoenix
protected void starting() {
// init animation values
if (start == null) {
oldCache = region.get().isCache();
oldCacheHint = region.get().getCacheHint();
radii = region.get().getBackground() == null ? null : region.get()
.getBackground()
.getFills()
.get(0)
.getRadii();
insets = region.get().getBackground() == null ? null : region.get()
.getBackground()
.getFills()
.get(0)
.getInsets();
start = fromValue.get();
end = toValue.get();
region.get().setCache(true);
region.get().setCacheHint(CacheHint.SPEED);
}
}
代码示例来源:origin: org.controlsfx/controlsfx
track.getBackground().getFills().get(0).getRadii().getTopLeftHorizontalRadius() : 0;
代码示例来源:origin: com.jfoenix/jfoenix
protected void starting() {
// init animation values
if (start == null) {
oldCache = region.get().isCache();
oldCacheHint = region.get().getCacheHint();
radii = region.get().getBackground() == null ? null : region.get()
.getBackground()
.getFills()
.get(0)
.getRadii();
insets = region.get().getBackground() == null ? null : region.get()
.getBackground()
.getFills()
.get(0)
.getInsets();
start = fromValue.get();
end = toValue.get();
region.get().setCache(true);
region.get().setCacheHint(CacheHint.SPEED);
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
public void updateFocusColor() {
Paint paint = control.getFocusColor();
focusedLine.setBackground(paint == null ? Background.EMPTY
: new Background(new BackgroundFill(paint, CornerRadii.EMPTY, Insets.EMPTY)));
}
代码示例来源:origin: jfoenixadmin/JFoenix
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)));
}
代码示例来源:origin: com.jfoenix/jfoenix
paraTransition.setOnFinished((finish) -> {
tabsHeader.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
}, newVal.fillProperty()));
pane.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
}, newVal.fillProperty()));
});
Color fontColor = ((Color) newVal.getFills().get(0).getFill()).grayscale()
.getRed() > 0.5 ? Color.valueOf(
"rgba(40, 40, 40, 0.87)") : Color.valueOf("rgba(255, 255, 255, 0.87)");
((Pane) tabs.lookup(".tab-selected-line")).setBackground(new Background(new BackgroundFill(fontColor,CornerRadii.EMPTY,Insets.EMPTY)));
pickerDecorator.lookupAll(".jfx-decorator-button").forEach(button -> {
((JFXButton) button).setRipplerFill(fontColor);
Color newColor = (Color) newVal.getFills().get(0).getFill();
String hex = String.format("#%02X%02X%02X",
(int) (newColor.getRed() * 255),
pane.setBackground(new Background(new BackgroundFill(curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
CornerRadii.EMPTY,
Insets.EMPTY)));
((Region) tabs.lookup(".tab-header-background")).setBackground(new Background(new BackgroundFill(
curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
CornerRadii.EMPTY,
tabsHeader.backgroundProperty().unbind();
代码示例来源:origin: jfoenixadmin/JFoenix
private void initStyle(StackPane pane) {
pane.setOpacity(1);
pane.setPrefSize(30, 4);
pane.setBackground(new Background(new BackgroundFill(Color.BLACK, new CornerRadii(5), Insets.EMPTY)));
}
代码示例来源:origin: jfoenixadmin/JFoenix
.getFills()
.get(0);
((Region) glyphDetailViewer.sizeSlider.lookup(lookup)).setBackground(new Background(new BackgroundFill(
Color.valueOf(webColor),
fill.getRadii(),
fill.getInsets())));
};
lookupConsumer.accept(THUMB);
.toString()
.substring(0, 8);
final BackgroundFill backgroundFill = new BackgroundFill(Color.valueOf(currentColor + DEFAULT_OPACITY),
lastClicked.getBackground().getFills().get(0).getRadii(),
null);
lastClicked.setBackground(new Background(backgroundFill));
button.setOnAction(event -> {
if (lastClicked != null) {
lastClicked.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, lastClicked.getBackground().getFills().get(0).getRadii(), null)));
.substring(0, 8);
button.setBackground(new Background(new BackgroundFill(Color.valueOf(currentColor + DEFAULT_OPACITY),
button.getBackground() == null ? null : button.getBackground().getFills().get(0).getRadii(),
null)));
lastClicked = button;
代码示例来源:origin: jfoenixadmin/JFoenix
public JFXPopupSkin(JFXPopup control) {
this.control = control;
// set scale y to 0.01 instead of 0 to allow layout of the content,
// otherwise it will cause exception in traverse engine, when focusing the 1st node
scale = new Scale(1, 0.01, 0, 0);
popupContent = control.getPopupContent();
container.getStyleClass().add("jfx-popup-container");
container.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
container.getChildren().add(popupContent);
container.getTransforms().add(scale);
container.setOpacity(0);
root = JFXDepthManager.createMaterialNode(container, 4);
animation = getAnimation();
}
代码示例来源:origin: jfoenixadmin/JFoenix
private StackPane createMask() {
StackPane mask = new StackPane();
mask.shapeProperty().bind(getSkinnable().shapeProperty());
mask.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
return new Background(new BackgroundFill(Color.WHITE,
getSkinnable().getBackground() != null
&& getSkinnable().getBackground().getFills().size() > 0 ?
getSkinnable().getBackground().getFills().get(0).getRadii() : CornerRadii.EMPTY,
getSkinnable().getBackground() != null
&& getSkinnable().getBackground().getFills().size() > 0 ?
getSkinnable().getBackground().getFills().get(0).getInsets() : Insets.EMPTY));
}, getSkinnable().backgroundProperty()));
mask.resize(getWidth() - snappedRightInset() - snappedLeftInset(),
getHeight() - snappedBottomInset() - snappedTopInset());
return mask;
}
};
代码示例来源:origin: jfoenixadmin/JFoenix
private void createWeekDaysCells() {
// create week days names
for (int i = 0; i < daysPerWeek; i++) {
DateCell cell = new DateCell();
cell.getStyleClass().add("day-name-cell");
cell.setTextFill(DEFAULT_CELL_COLOR);
cell.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
cell.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
cell.setAlignment(Pos.BASELINE_CENTER);
weekDaysCells.add(cell);
}
// create week days numbers
for (int i = 0; i < 6; i++) {
DateCell cell = new DateCell();
cell.getStyleClass().add("week-number-cell");
cell.setTextFill(DEFAULT_CELL_COLOR);
cell.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
cell.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
weekNumberCells.add(cell);
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
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);
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
private JFXButton createNextButton(TreeItem temp) {
return new JFXButton(temp.getValue().toString()) {
{
setPadding(new Insets(getOffset(), 1.5 * getOffset(), getOffset(), 2 * getOffset()));
setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
}
@Override
protected void layoutChildren() {
super.layoutChildren();
double width = getWidth();
Polygon polygon = new Polygon();
final double height = getHeight();
polygon.getPoints().addAll(new Double[] {
0.0, 0.0,
width - getOffset(), 0.0,
width, height / 2,
width - getOffset(), height,
0.0, height,
getOffset(), height / 2});
setClip(polygon);
}
};
}
代码示例来源:origin: jfoenixadmin/JFoenix
} 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());
mark.setScaleX(0);
mark.setOpacity(0);
box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, radii, insets)));
select.playFrom(Duration.ZERO);
transition.playFrom(Duration.ZERO);
代码示例来源:origin: jfoenixadmin/JFoenix
private JFXButton createLastButton(TreeItem temp, TreeItem parent) {
return new JFXButton(temp.getValue().toString()) {
private boolean noParent = parent == null;
{
setPadding(new Insets(getOffset(), getOffset(), getOffset(), (noParent? 1 : 2) * getOffset()));
setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
}
@Override
protected void layoutChildren() {
super.layoutChildren();
double width = getWidth();
Polygon polygon = new Polygon();
final double height = getHeight();
polygon.getPoints().addAll(new Double[] {
0.0, 0.0,
width, 0.0,
width, height,
0.0, height,
noParent ? 0 : getOffset(), noParent ? 0 : height / 2});
setClip(polygon);
}
};
}
代码示例来源:origin: jfoenixadmin/JFoenix
return new Background(new BackgroundFill(Color.WHITE,
colorBox.backgroundProperty()
.get() != null ? colorBox.getBackground()
.getFills()
.get(0)
.getRadii() : new CornerRadii(
3),
colorBox.backgroundProperty()
.getFills()
.get(0)
.getInsets() : Insets.EMPTY));
}, colorBox.backgroundProperty()));
colorBox.setClip(pickerColorClip);
代码示例来源:origin: jfoenixadmin/JFoenix
public JFXButton createFirstButton(TreeItem temp) {
return new JFXButton(temp.getValue().toString()) {
{
setPadding(new Insets(getOffset(), 1.5 * getOffset(), getOffset(), getOffset()));
setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
}
@Override
protected void layoutChildren() {
super.layoutChildren();
double width = getWidth();
Polygon polygon = new Polygon();
final double height = getHeight();
polygon.getPoints().addAll(new Double[] {
0.0, 0.0,
width - getOffset(), 0.0,
width, height / 2,
width - getOffset(), height,
0.0, height});
setClip(polygon);
}
};
}
内容来源于网络,如有侵权,请联系作者删除!