javafx.scene.layout.Region.getStyleClass()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(166)

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

Region.getStyleClass介绍

暂无

代码示例

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

private Node createButton() {
  Region btn = new Region();
  btn.getStyleClass().add("button"); //$NON-NLS-1$
  
  btn.setOnMouseMoved(mouseMoveHandler);
  btn.setOnMouseClicked(mouseClickHandler);
  return btn;
}

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

public SelectionLayer() {
  this.selectionMarker.getStyleClass().add(CSS_CLASS_SELECTION_MARKER);
  this.selectionMarker.setManaged(false);
  this.getChildren().setAll(this.selectionMarker);
}

代码示例来源:origin: com.aquafx-project/aquafx

@Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
    if (newValue != null && newValue != oldValue) {
      if (newValue.booleanValue()) {
        if (searchIconPath == null) {
          searchIconPath = new Region();
          searchIconPath.getStyleClass().add("icon-search");
        }
        getChildren().add(searchIconPath);
      } else if (oldValue != null && searchIconPath != null) {
        getChildren().remove(searchIconPath);
      }
      getSkinnable().requestLayout();
    }
  }
});

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * {@inheritDoc}
 */
@Override
protected Node createContent() {
  final GridPane informationContentPane = new GridPane();
  informationContentPane.getStyleClass().add("grid");
  engineUserData.addListener((Observable invalidation) -> updateUserData(informationContentPane));
  updateUserData(informationContentPane);
  final HBox buttonBox = createEngineButtons();
  final Region informationContentSpacer = new Region();
  informationContentSpacer.getStyleClass().add("engineSpacer");
  final Region buttonBoxSpacer = new Region();
  buttonBoxSpacer.getStyleClass().add("engineSpacer");
  return new VBox(informationContentPane, informationContentSpacer, buttonBox, buttonBoxSpacer);
}

代码示例来源:origin: com.aquafx-project/aquafx

@Override public void changed(ObservableValue<? extends MacOSDefaultIcons> observable, MacOSDefaultIcons oldValue,
      MacOSDefaultIcons newValue) {
    if (newValue != null && newValue != oldValue) {
      if (newValue == MacOSDefaultIcons.SHARE) {
        StackPane stack = new StackPane();
        String iconBase = MacOSDefaultIcons.SHARE.getStyleName();
        stack.getStyleClass().add("aquaicon");
        Region svgIcon = new Region();
        svgIcon.getStyleClass().add(iconBase + "-square");
        stack.getChildren().add(svgIcon);
        Region svgIcon2 = new Region();
        svgIcon2.getStyleClass().add(iconBase + "-arrow");
        stack.getChildren().add(svgIcon2);
        getSkinnable().setGraphic(stack);
      } else {
        Region svgIcon = new Region();
        svgIcon.getStyleClass().add("aqua-" + newValue.getStyleName());
        svgIcon.getStyleClass().add("aquaicon");
        getSkinnable().setGraphic(svgIcon);
        getSkinnable().getStyleClass().add("button-" + newValue.getStyleName());
      }
      getSkinnable().requestLayout();
    }
  }
});

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * Creates a miniature icon for the item
 * @return A miniature icon for the item
 */
private Region createMiniature() {
  final Region icon = new Region();
  icon.getStyleClass().add("compactListMiniatureImage");
  icon.styleProperty().bind(
      Bindings.createStringBinding(
          () -> String.format("-fx-background-image: url(\"%s\");",
              getControl().getMiniatureUri().toString()),
          getControl().miniatureUriProperty()));
  return icon;
}

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * Creates a mapped list between the <code>miniatureUris</code> and a {@link Region} component
 *
 * @return A mapped list between miniatureUris and a Region component
 */
private ObservableList<Region> createMiniatures() {
  return new MappedList<>(miniatureUris, miniatureUri -> {
    final Region image = new Region();
    image.getStyleClass().add("appMiniature");
    image.setStyle(String.format("-fx-background-image: url(\"%s\");", miniatureUri.toString()));
    image.prefHeightProperty().bind(miniatureHeight);
    image.prefWidthProperty().bind(miniatureHeight.multiply(1.5));
    return image;
  });
}

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * {@inheritDoc}
 */
@Override
protected Node createContent() {
  final Label descriptionLabel = new Label();
  descriptionLabel.textProperty().bind(description);
  descriptionLabel.setWrapText(true);
  final GridPane propertiesGrid = createPropertiesGrid();
  final Region spacer = new Region();
  spacer.getStyleClass().add("detailsButtonSpacer");
  final GridPane controlButtons = createControlButtons();
  return new VBox(descriptionLabel, propertiesGrid, spacer, controlButtons);
}

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * {@inheritDoc}
 */
@Override
protected Node createContent() {
  final Label descriptionLabel = new Label();
  descriptionLabel.textProperty().bind(description);
  descriptionLabel.setWrapText(true);
  final GridPane propertiesGrid = createPropertiesGrid();
  final Region spacer = new Region();
  spacer.getStyleClass().add("detailsButtonSpacer");
  final Button saveButton = new Button(tr("Save"));
  saveButton.setOnMouseClicked(event -> Optional.ofNullable(getControl().getOnShortcutChanged()).ifPresent(
      onShortcutChanged -> onShortcutChanged.accept(getControl().getShortcut())));
  return new VBox(descriptionLabel, propertiesGrid, spacer, saveButton);
}

代码示例来源:origin: com.aquafx-project/aquafx

if (cancelSearchIconPath == null) {
  cancelSearchIconPath = new Region();
  cancelSearchIconPath.getStyleClass().add("icon-delete");

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

plusRegion.getStyleClass().add("adjust-plus"); //$NON-NLS-1$
minusRegion.getStyleClass().add("adjust-minus"); //$NON-NLS-1$

代码示例来源:origin: PhoenicisOrg/phoenicis

/**
 * Creates a region with the miniature of the list element
 *
 * @return A region with the miniature of the list element
 */
private Region createMiniature() {
  final Region miniature = new Region();
  miniature.getStyleClass().add("iconListMiniatureImage");
  miniature.styleProperty().bind(
      Bindings.createStringBinding(
          () -> String.format("-fx-background-image: url(\"%s\");",
              getControl().getMiniatureUri().toString()),
          getControl().miniatureUriProperty()));
  final Tooltip tooltip = new Tooltip();
  tooltip.textProperty().bind(getControl().titleProperty());
  Tooltip.install(miniature, tooltip);
  // set a gray filter for this element if it is not enabled
  getControl().enabledProperty().addListener((Observable invalidation) -> updateEnabled(miniature));
  // adopt the enable status during initialisation
  updateEnabled(miniature);
  return miniature;
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

this.selectionMarker.setVisible(false);
this.selectionMarker.setManaged(false);
this.selectionMarker.getStyleClass().add("selection-marker"); //$NON-NLS-1$
this.caret.setVisible(false);
this.caret.setStrokeWidth(2);

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

clearButton.getStyleClass().addAll("graphic"); //$NON-NLS-1$
StackPane clearButtonPane = new StackPane(clearButton);
clearButtonPane.getStyleClass().addAll("clear-button"); //$NON-NLS-1$

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

spacer.getStyleClass().addAll(CSS_CLASS_LINE_RULER, CSS_CLASS_SPACER);
spacer.setMinWidth(2);
spacer.setMaxWidth(2);

相关文章

微信公众号

最新文章

更多