javafx.scene.layout.BackgroundFill类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(12.9k)|赞(0)|评价(0)|浏览(209)

本文整理了Java中javafx.scene.layout.BackgroundFill类的一些代码示例,展示了BackgroundFill类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BackgroundFill类的具体详情如下:
包路径:javafx.scene.layout.BackgroundFill
类名称:BackgroundFill

BackgroundFill介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public void updateUnfocusColor() {
  2. Paint paint = control.getUnFocusColor();
  3. line.setBackground(paint == null ? Background.EMPTY
  4. : new Background(new BackgroundFill(paint, CornerRadii.EMPTY, Insets.EMPTY)));
  5. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public static void updateBackground(Background newBackground, Region nodeToUpdate, Paint fill) {
  2. if (newBackground != null && !newBackground.getFills().isEmpty()) {
  3. final BackgroundFill[] fills = new BackgroundFill[newBackground.getFills().size()];
  4. for (int i = 0; i < newBackground.getFills().size(); i++) {
  5. BackgroundFill bf = newBackground.getFills().get(i);
  6. fills[i] = new BackgroundFill(fill, bf.getRadii(), bf.getInsets());
  7. }
  8. nodeToUpdate.setBackground(new Background(fills));
  9. }
  10. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. paraTransition.setOnFinished((finish) -> {
  2. tabsHeader.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
  3. return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
  4. }, newVal.fillProperty()));
  5. pane.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
  6. return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
  7. }, newVal.fillProperty()));
  8. });
  9. Color fontColor = ((Color) newVal.getFills().get(0).getFill()).grayscale()
  10. .getRed() > 0.5 ? Color.valueOf(
  11. "rgba(40, 40, 40, 0.87)") : Color.valueOf("rgba(255, 255, 255, 0.87)");
  12. ((Pane) tabs.lookup(".tab-selected-line")).setBackground(new Background(new BackgroundFill(fontColor,CornerRadii.EMPTY,Insets.EMPTY)));
  13. pickerDecorator.lookupAll(".jfx-decorator-button").forEach(button -> {
  14. ((JFXButton) button).setRipplerFill(fontColor);
  15. Color newColor = (Color) newVal.getFills().get(0).getFill();
  16. String hex = String.format("#%02X%02X%02X",
  17. (int) (newColor.getRed() * 255),
  18. pane.setBackground(new Background(new BackgroundFill(curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
  19. CornerRadii.EMPTY,
  20. Insets.EMPTY)));
  21. ((Region) tabs.lookup(".tab-header-background")).setBackground(new Background(new BackgroundFill(
  22. curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
  23. CornerRadii.EMPTY,
  24. tabsHeader.backgroundProperty().unbind();

代码示例来源:origin: jfoenixadmin/JFoenix

  1. protected void starting() {
  2. // init animation values
  3. if (start == null) {
  4. oldCache = region.get().isCache();
  5. oldCacheHint = region.get().getCacheHint();
  6. radii = region.get().getBackground() == null ? null : region.get()
  7. .getBackground()
  8. .getFills()
  9. .get(0)
  10. .getRadii();
  11. insets = region.get().getBackground() == null ? null : region.get()
  12. .getBackground()
  13. .getFills()
  14. .get(0)
  15. .getInsets();
  16. start = fromValue.get();
  17. end = toValue.get();
  18. region.get().setCache(true);
  19. region.get().setCacheHint(CacheHint.SPEED);
  20. }
  21. }

代码示例来源:origin: org.controlsfx/controlsfx

  1. track.getBackground().getFills().get(0).getRadii().getTopLeftHorizontalRadius() : 0;

代码示例来源:origin: com.jfoenix/jfoenix

  1. protected void starting() {
  2. // init animation values
  3. if (start == null) {
  4. oldCache = region.get().isCache();
  5. oldCacheHint = region.get().getCacheHint();
  6. radii = region.get().getBackground() == null ? null : region.get()
  7. .getBackground()
  8. .getFills()
  9. .get(0)
  10. .getRadii();
  11. insets = region.get().getBackground() == null ? null : region.get()
  12. .getBackground()
  13. .getFills()
  14. .get(0)
  15. .getInsets();
  16. start = fromValue.get();
  17. end = toValue.get();
  18. region.get().setCache(true);
  19. region.get().setCacheHint(CacheHint.SPEED);
  20. }
  21. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public void updateFocusColor() {
  2. Paint paint = control.getFocusColor();
  3. focusedLine.setBackground(paint == null ? Background.EMPTY
  4. : new Background(new BackgroundFill(paint, CornerRadii.EMPTY, Insets.EMPTY)));
  5. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public void updateSelectionBackground() {
  2. CornerRadii radii = getSkinnable().getBackground() == null ? CornerRadii.EMPTY : getSkinnable().getBackground()
  3. .getFills()
  4. .get(0)
  5. .getRadii();
  6. Insets insets = getSkinnable().getBackground() == null ? Insets.EMPTY : getSkinnable().getBackground()
  7. .getFills()
  8. .get(0)
  9. .getInsets();
  10. selectionOverLay.setBackground(new Background(new BackgroundFill(getSkinnable().isSelected() ? ((JFXToggleNode) getSkinnable())
  11. .getSelectedColor() : ((JFXToggleNode) getSkinnable()).getUnSelectedColor(), radii, insets)));
  12. }

代码示例来源:origin: com.jfoenix/jfoenix

  1. paraTransition.setOnFinished((finish) -> {
  2. tabsHeader.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
  3. return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
  4. }, newVal.fillProperty()));
  5. pane.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
  6. return new Background(new BackgroundFill(newVal.getFill(), CornerRadii.EMPTY, Insets.EMPTY));
  7. }, newVal.fillProperty()));
  8. });
  9. Color fontColor = ((Color) newVal.getFills().get(0).getFill()).grayscale()
  10. .getRed() > 0.5 ? Color.valueOf(
  11. "rgba(40, 40, 40, 0.87)") : Color.valueOf("rgba(255, 255, 255, 0.87)");
  12. ((Pane) tabs.lookup(".tab-selected-line")).setBackground(new Background(new BackgroundFill(fontColor,CornerRadii.EMPTY,Insets.EMPTY)));
  13. pickerDecorator.lookupAll(".jfx-decorator-button").forEach(button -> {
  14. ((JFXButton) button).setRipplerFill(fontColor);
  15. Color newColor = (Color) newVal.getFills().get(0).getFill();
  16. String hex = String.format("#%02X%02X%02X",
  17. (int) (newColor.getRed() * 255),
  18. pane.setBackground(new Background(new BackgroundFill(curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
  19. CornerRadii.EMPTY,
  20. Insets.EMPTY)));
  21. ((Region) tabs.lookup(".tab-header-background")).setBackground(new Background(new BackgroundFill(
  22. curvedColorPicker.getColor(curvedColorPicker.getSelectedIndex()),
  23. CornerRadii.EMPTY,
  24. tabsHeader.backgroundProperty().unbind();

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private void initStyle(StackPane pane) {
  2. pane.setOpacity(1);
  3. pane.setPrefSize(30, 4);
  4. pane.setBackground(new Background(new BackgroundFill(Color.BLACK, new CornerRadii(5), Insets.EMPTY)));
  5. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. .getFills()
  2. .get(0);
  3. ((Region) glyphDetailViewer.sizeSlider.lookup(lookup)).setBackground(new Background(new BackgroundFill(
  4. Color.valueOf(webColor),
  5. fill.getRadii(),
  6. fill.getInsets())));
  7. };
  8. lookupConsumer.accept(THUMB);
  9. .toString()
  10. .substring(0, 8);
  11. final BackgroundFill backgroundFill = new BackgroundFill(Color.valueOf(currentColor + DEFAULT_OPACITY),
  12. lastClicked.getBackground().getFills().get(0).getRadii(),
  13. null);
  14. lastClicked.setBackground(new Background(backgroundFill));
  15. button.setOnAction(event -> {
  16. if (lastClicked != null) {
  17. lastClicked.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, lastClicked.getBackground().getFills().get(0).getRadii(), null)));
  18. .substring(0, 8);
  19. button.setBackground(new Background(new BackgroundFill(Color.valueOf(currentColor + DEFAULT_OPACITY),
  20. button.getBackground() == null ? null : button.getBackground().getFills().get(0).getRadii(),
  21. null)));
  22. lastClicked = button;

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public JFXPopupSkin(JFXPopup control) {
  2. this.control = control;
  3. // set scale y to 0.01 instead of 0 to allow layout of the content,
  4. // otherwise it will cause exception in traverse engine, when focusing the 1st node
  5. scale = new Scale(1, 0.01, 0, 0);
  6. popupContent = control.getPopupContent();
  7. container.getStyleClass().add("jfx-popup-container");
  8. container.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
  9. container.getChildren().add(popupContent);
  10. container.getTransforms().add(scale);
  11. container.setOpacity(0);
  12. root = JFXDepthManager.createMaterialNode(container, 4);
  13. animation = getAnimation();
  14. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private StackPane createMask() {
  2. StackPane mask = new StackPane();
  3. mask.shapeProperty().bind(getSkinnable().shapeProperty());
  4. mask.backgroundProperty().bind(Bindings.createObjectBinding(() -> {
  5. return new Background(new BackgroundFill(Color.WHITE,
  6. getSkinnable().getBackground() != null
  7. && getSkinnable().getBackground().getFills().size() > 0 ?
  8. getSkinnable().getBackground().getFills().get(0).getRadii() : CornerRadii.EMPTY,
  9. getSkinnable().getBackground() != null
  10. && getSkinnable().getBackground().getFills().size() > 0 ?
  11. getSkinnable().getBackground().getFills().get(0).getInsets() : Insets.EMPTY));
  12. }, getSkinnable().backgroundProperty()));
  13. mask.resize(getWidth() - snappedRightInset() - snappedLeftInset(),
  14. getHeight() - snappedBottomInset() - snappedTopInset());
  15. return mask;
  16. }
  17. };

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private void createWeekDaysCells() {
  2. // create week days names
  3. for (int i = 0; i < daysPerWeek; i++) {
  4. DateCell cell = new DateCell();
  5. cell.getStyleClass().add("day-name-cell");
  6. cell.setTextFill(DEFAULT_CELL_COLOR);
  7. cell.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
  8. cell.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
  9. cell.setAlignment(Pos.BASELINE_CENTER);
  10. weekDaysCells.add(cell);
  11. }
  12. // create week days numbers
  13. for (int i = 0; i < 6; i++) {
  14. DateCell cell = new DateCell();
  15. cell.getStyleClass().add("week-number-cell");
  16. cell.setTextFill(DEFAULT_CELL_COLOR);
  17. cell.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
  18. cell.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
  19. weekNumberCells.add(cell);
  20. }
  21. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private void playIndeterminateAnimation(Boolean indeterminate, boolean playAnimation) {
  2. if (indeterminate == null) {
  3. indeterminate = false;
  4. }
  5. indeterminateTransition.setRate(indeterminate ? 1 : -1);
  6. if (playAnimation) {
  7. indeterminateTransition.play();
  8. } else {
  9. if (indeterminate) {
  10. CornerRadii radii = indeterminateMark.getBackground() == null ?
  11. null : indeterminateMark.getBackground().getFills().get(0).getRadii();
  12. Insets insets = indeterminateMark.getBackground() == null ?
  13. null : indeterminateMark.getBackground().getFills().get(0).getInsets();
  14. indeterminateMark.setOpacity(1);
  15. indeterminateMark.setScaleY(1);
  16. indeterminateMark.setScaleX(1);
  17. indeterminateMark.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
  18. indeterminateTransition.playFrom(indeterminateTransition.getCycleDuration());
  19. } else {
  20. indeterminateMark.setOpacity(0);
  21. indeterminateMark.setScaleY(0);
  22. indeterminateMark.setScaleX(0);
  23. indeterminateTransition.playFrom(Duration.ZERO);
  24. }
  25. }
  26. if(getSkinnable().isSelected()){
  27. playSelectAnimation(!indeterminate, playAnimation);
  28. }
  29. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private JFXButton createNextButton(TreeItem temp) {
  2. return new JFXButton(temp.getValue().toString()) {
  3. {
  4. setPadding(new Insets(getOffset(), 1.5 * getOffset(), getOffset(), 2 * getOffset()));
  5. setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
  6. }
  7. @Override
  8. protected void layoutChildren() {
  9. super.layoutChildren();
  10. double width = getWidth();
  11. Polygon polygon = new Polygon();
  12. final double height = getHeight();
  13. polygon.getPoints().addAll(new Double[] {
  14. 0.0, 0.0,
  15. width - getOffset(), 0.0,
  16. width, height / 2,
  17. width - getOffset(), height,
  18. 0.0, height,
  19. getOffset(), height / 2});
  20. setClip(polygon);
  21. }
  22. };
  23. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. } else {
  2. CornerRadii radii = box.getBackground() == null ?
  3. null : box.getBackground().getFills().get(0).getRadii();
  4. Insets insets = box.getBackground() == null ?
  5. null : box.getBackground().getFills().get(0).getInsets();
  6. if (selection) {
  7. mark.setScaleY(1);
  8. mark.setScaleX(1);
  9. mark.setOpacity(1);
  10. box.setBackground(new Background(new BackgroundFill(getSkinnable().getCheckedColor(), radii, insets)));
  11. select.playFrom(select.getCycleDuration());
  12. transition.playFrom(transition.getCycleDuration());
  13. mark.setScaleX(0);
  14. mark.setOpacity(0);
  15. box.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, radii, insets)));
  16. select.playFrom(Duration.ZERO);
  17. transition.playFrom(Duration.ZERO);

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private JFXButton createLastButton(TreeItem temp, TreeItem parent) {
  2. return new JFXButton(temp.getValue().toString()) {
  3. private boolean noParent = parent == null;
  4. {
  5. setPadding(new Insets(getOffset(), getOffset(), getOffset(), (noParent? 1 : 2) * getOffset()));
  6. setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
  7. }
  8. @Override
  9. protected void layoutChildren() {
  10. super.layoutChildren();
  11. double width = getWidth();
  12. Polygon polygon = new Polygon();
  13. final double height = getHeight();
  14. polygon.getPoints().addAll(new Double[] {
  15. 0.0, 0.0,
  16. width, 0.0,
  17. width, height,
  18. 0.0, height,
  19. noParent ? 0 : getOffset(), noParent ? 0 : height / 2});
  20. setClip(polygon);
  21. }
  22. };
  23. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. return new Background(new BackgroundFill(Color.WHITE,
  2. colorBox.backgroundProperty()
  3. .get() != null ? colorBox.getBackground()
  4. .getFills()
  5. .get(0)
  6. .getRadii() : new CornerRadii(
  7. 3),
  8. colorBox.backgroundProperty()
  9. .getFills()
  10. .get(0)
  11. .getInsets() : Insets.EMPTY));
  12. }, colorBox.backgroundProperty()));
  13. colorBox.setClip(pickerColorClip);

代码示例来源:origin: jfoenixadmin/JFoenix

  1. public JFXButton createFirstButton(TreeItem temp) {
  2. return new JFXButton(temp.getValue().toString()) {
  3. {
  4. setPadding(new Insets(getOffset(), 1.5 * getOffset(), getOffset(), getOffset()));
  5. setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
  6. }
  7. @Override
  8. protected void layoutChildren() {
  9. super.layoutChildren();
  10. double width = getWidth();
  11. Polygon polygon = new Polygon();
  12. final double height = getHeight();
  13. polygon.getPoints().addAll(new Double[] {
  14. 0.0, 0.0,
  15. width - getOffset(), 0.0,
  16. width, height / 2,
  17. width - getOffset(), height,
  18. 0.0, height});
  19. setClip(polygon);
  20. }
  21. };
  22. }

相关文章