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

x33g5p2x  于2022-01-16 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(314)

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

Button.getStyleClass介绍

暂无

代码示例

代码示例来源:origin: torakiki/pdfsam

private Button buildButton(String text, boolean response) {
  Button button = new Button(text);
  button.getStyleClass().addAll(Style.BUTTON.css());
  button.setOnAction(e -> {
    this.response = response;
    hide();
  });
  return button;
}

代码示例来源:origin: torakiki/pdfsam

public ClosePane(EventHandler<ActionEvent> handler) {
    setAlignment(Pos.CENTER_RIGHT);
    getStyleClass().addAll(Style.CONTAINER.css());
    Button closeButton = new Button(DefaultI18nContext.getInstance().i18n("Close"));
    closeButton.getStyleClass().addAll(Style.BUTTON.css());
    closeButton.setTextAlignment(TextAlignment.CENTER);
    closeButton.setOnAction(ofNullable(handler).orElse(defaultHandler));
    getChildren().add(closeButton);
  }
}

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

closeButton.getStyleClass().add("tab-close-button");
closeButton.setOnAction(action->{
  TabPaneBehavior behavior = getBehavior();

代码示例来源:origin: torakiki/pdfsam

OpenWithDialog initFor(InputPdfArgumentsLoadRequest event) {
  this.messageTitle
      .setText(DefaultI18nContext.getInstance().i18n("Select the task to perform on the following files"));
  filesList
      .setItems(FXCollections.observableArrayList(event.pdfs.stream().map(Path::toString).collect(toList())));
  modules.forEach(m -> {
    if (m.descriptor().hasInputType(event.requiredInputTyle())) {
      Button current = new Button(m.descriptor().getName());
      current.getStyleClass().addAll(Style.FOOTER_BUTTON.css());
      Optional.ofNullable(m.graphic()).ifPresent(g -> {
        g.setScaleX(0.7);
        g.setScaleY(0.7);
        current.setGraphic(g);
      });
      current.setOnAction((e) -> {
        eventStudio().broadcast(new ClearModuleEvent(), m.id());
        eventStudio().broadcast(activeteModule(m.id()));
        hide();
        PdfLoadRequestEvent loadEvent = new PdfLoadRequestEvent(m.id());
        event.pdfs.stream().map(Path::toFile).map(PdfDocumentDescriptor::newDescriptorNoPassword)
            .forEach(loadEvent::add);
        eventStudio().broadcast(loadEvent, m.id());
      });
      buttons.getChildren().add(current);
    }
  });
  return this;
}

代码示例来源:origin: torakiki/pdfsam

public DashboardTile(String title, String description, Node graphic) {
  getStyleClass().addAll("dashboard-modules-tile");
  Label titleLabel = new Label(title);
  titleLabel.getStyleClass().add("dashboard-modules-tile-title");
  if (nonNull(graphic)) {
    titleLabel.setGraphic(graphic);
  }
  Label textLabel = new Label(description);
  textLabel.getStyleClass().add("dashboard-modules-tile-text");
  textLabel.setMinHeight(USE_PREF_SIZE);
  VBox topTile = new VBox(5);
  topTile.getChildren().addAll(titleLabel, textLabel);
  button.getStyleClass().add("dashboard-modules-invisible-button");
  button.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
  armed.bind(button.armedProperty());
  getChildren().addAll(new StackPane(topTile, button));
  setMaxHeight(USE_PREF_SIZE);
  setMinHeight(USE_PREF_SIZE);
}

代码示例来源:origin: torakiki/pdfsam

public NewsPanel() {
  getStyleClass().add("news-panel");
  getStyleClass().addAll(Style.CONTAINER.css());
  Button closeButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.TIMES);
  closeButton.getStyleClass().addAll("close-button");
  closeButton.setOnAction(e -> eventStudio().broadcast(HideNewsPanelRequest.INSTANCE));
  Label titleLabel = new Label(DefaultI18nContext.getInstance().i18n("What's new"));
  titleLabel.setPrefWidth(Integer.MAX_VALUE);
  titleLabel.getStyleClass().add("news-panel-title");
  StackPane top = new StackPane(titleLabel, closeButton);
  top.setAlignment(Pos.TOP_RIGHT);
  scroll.getStyleClass().add("scrollable-news");
  scroll.setHbarPolicy(ScrollBarPolicy.NEVER);
  scroll.setFitToHeight(true);
  scroll.setFitToWidth(true);
  getChildren().addAll(top, scroll);
  eventStudio().addAnnotatedListeners(this);
}

代码示例来源:origin: torakiki/pdfsam

private HBox buildFooter() {
  Button closeButton = new Button(DefaultI18nContext.getInstance().i18n("Close"));
  closeButton.getStyleClass().addAll(Style.BUTTON.css());
  closeButton.setTextAlignment(TextAlignment.CENTER);
  closeButton.setOnAction(e -> eventStudio().broadcast(activeteCurrentModule()));
  HBox footer = new HBox(closeButton);
  footer.getStyleClass().addAll(Style.CLOSE_FOOTER.css());
  return footer;
}

代码示例来源:origin: torakiki/pdfsam

public HidingPane() {
    Button closeButton = new Button(DefaultI18nContext.getInstance().i18n("Close"));
    closeButton.getStyleClass().addAll(Style.BUTTON.css());
    closeButton.setTextAlignment(TextAlignment.CENTER);
    closeButton.setOnAction(e -> this.setVisible(false));
    HBox bottom = new HBox(closeButton);
    bottom.setAlignment(Pos.CENTER_RIGHT);
    bottom.getStyleClass().addAll(Style.CONTAINER.css());
    super.setBottom(bottom);
  }
}

代码示例来源:origin: torakiki/pdfsam

public BrowsableField() {
  HBox.setHgrow(textField, Priority.ALWAYS);
  this.getStyleClass().add("browsable-field");
  validableContainer = new HBox(textField);
  validableContainer.getStyleClass().add("validable-container");
  textField.getStyleClass().add("validable-container-field");
  browseButton = new Button(DefaultI18nContext.getInstance().i18n("Browse"));
  browseButton.getStyleClass().addAll(Style.BROWSE_BUTTON.css());
  browseButton.prefHeightProperty().bind(validableContainer.heightProperty());
  browseButton.setMaxHeight(USE_PREF_SIZE);
  browseButton.setMinHeight(USE_PREF_SIZE);
  HBox.setHgrow(validableContainer, Priority.ALWAYS);
  textField.validProperty().addListener((o, oldValue, newValue) -> {
    if (newValue == ValidationState.INVALID) {
      validableContainer.getStyleClass().addAll(Style.INVALID.css());
    } else {
      validableContainer.getStyleClass().removeAll(Style.INVALID.css());
    }
  });
  textField.focusedProperty().addListener(
      (o, oldVal, newVal) -> validableContainer.pseudoClassStateChanged(SELECTED_PSEUDOCLASS_STATE, newVal));
  getChildren().addAll(validableContainer, browseButton);
}

代码示例来源:origin: torakiki/pdfsam

Notification(String title, Node content) {
  requireNotNull(content, "Notification content cannot be blank");
  getStyleClass().add("notification");
  getStyleClass().addAll(Style.CONTAINER.css());
  setId(UUID.randomUUID().toString());
  Button closeButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.TIMES);
  closeButton.getStyleClass().addAll("close-button");
  closeButton.setOnAction(e -> eventStudio().broadcast(new RemoveNotificationRequestEvent(getId())));
  Label titleLabel = new Label(title);
  titleLabel.setPrefWidth(Integer.MAX_VALUE);
  titleLabel.getStyleClass().add("notification-title");
  StackPane top = new StackPane(titleLabel, closeButton);
  top.setAlignment(Pos.TOP_RIGHT);
  getChildren().addAll(top, content);
  setOpacity(0);
  setOnMouseEntered(e -> {
    fade.stop();
    setOpacity(1);
  });
  setOnMouseClicked(e -> {
    setOnMouseEntered(null);
    setOnMouseExited(null);
    fade.stop();
    eventStudio().broadcast(new RemoveNotificationRequestEvent(getId()));
  });
  fade.setFromValue(1);
  fade.setToValue(0);
}

代码示例来源:origin: torakiki/pdfsam

public PasswordFieldPopupContent() {
  getStyleClass().setAll("pdfsam-input-password-content");
  passwordField.setPromptText(DefaultI18nContext.getInstance().i18n("Enter the user password"));
  Button doneButton = FontAwesomeIconFactory.get().createIconButton(FontAwesomeIcon.UNLOCK,
      DefaultI18nContext.getInstance().i18n("Unlock"));
  doneButton.getStyleClass().addAll(Style.BUTTON.css());
  doneButton.prefHeightProperty().bind(passwordField.heightProperty());
  doneButton.setMaxHeight(USE_PREF_SIZE);
  doneButton.setMinHeight(USE_PREF_SIZE);
  doneButton.setOnAction(e -> requestLoad());
  passwordField.setOnAction(e -> requestLoad());
  getChildren().addAll(passwordField, doneButton);
}

代码示例来源:origin: torakiki/pdfsam

Button copyButton = new Button(DefaultI18nContext.getInstance().i18n("Copy to clipboard"));
FontAwesomeIconFactory.get().setIcon(copyButton, FontAwesomeIcon.COPY);
copyButton.getStyleClass().addAll(Style.BUTTON.css());
copyButton.setId("copyEnvDetails");
copyButton.setOnAction(a -> {

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

/**
 * Creates a new {@link Button} object used to clear the search box
 *
 * @return The created clear button
 */
private Button createClearButton() {
  Button clearButton = new Button();
  clearButton.getStyleClass().add("searchCleanButton");
  AnchorPane.setRightAnchor(clearButton, 0.0);
  return clearButton;
}

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

private Button createCrumb(
      final Callback<TreeItem<T>, Button> factory,
      final TreeItem<T> selectedCrumb) {

    Button crumb = factory.call(selectedCrumb);
    
    crumb.getStyleClass().add("crumb"); //$NON-NLS-1$

    // We want all buttons to have the same height
    // so we bind their preferred height to the enclosing container
//        crumb.prefHeightProperty().bind(getSkinnable().heightProperty());

    // listen to the action event of each bread crumb
    crumb.setOnAction(ae -> onBreadCrumbAction(selectedCrumb));

    return crumb;
  }

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

private void setDropShadow() {
  boolean isPill = false;
  if (getSkinnable().getStyleClass().contains(ButtonType.LEFT_PILL.getStyleName()) || getSkinnable().getStyleClass().contains(
      ButtonType.CENTER_PILL.getStyleName()) || getSkinnable().getStyleClass().contains(
      ButtonType.RIGHT_PILL.getStyleName())) {
    isPill = true;
  }
  getSkinnable().setEffect(new Shadow(isPill));
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

public ErrorDialog buildPrimary(AbstractViewController controller) {
 final ErrorDialog dialog = (ErrorDialog) Services.getBean("ErrorDialog");
 dialog.buildFrom(controller, getPrimaryDialogConfig());
 dialog.dialogHeader.setTitle(title);
 dialog.dialogContent.setMessage(message);
 dialog.callBack = this.callBack;
 if(callBack == null) {
  dialog.hideFooter();
 }
 dialog.okButton.getStyleClass().addAll("button-xl", "button-primary");
 return dialog;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

public ErrorDialog buildAccent(AbstractViewController controller) {
 final ErrorDialog dialog = (ErrorDialog) Services.getBean("ErrorDialog");
 dialog.buildFrom(controller, getAccentDialogConfig());
 dialog.dialogHeader.setTitle(title);
 dialog.dialogContent.setMessage(message);
 dialog.callBack = this.callBack;
 if(callBack == null) {
  dialog.hideFooter();
 }
 dialog.okButton.getStyleClass().addAll("button-xl", "button-accent");
 return dialog;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

public WarningDialog buildPrimary(AbstractViewController controller) {
 final WarningDialog dialog = (WarningDialog) Services.getBean("WarningDialog");
 dialog.buildFrom(controller, getPrimaryDialogConfig());
 dialog.dialogHeader.setTitle(title);
 dialog.dialogContent.setMessage(message);
 dialog.callBack = this.callBack;
 if(callBack == null) {
  dialog.hideFooter();
 }
 dialog.okButton.getStyleClass().addAll("button-xl", "button-primary");
 return dialog;
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Build done button
 */
private void buildDoneButton() {
 doneButton.getStyleClass().addAll("button-small", "table-toolbar-action", "ep-button");
 doneButton.setOnAction(e -> modifyClicked(controller));
 doneButton.setText(controller.getGLocalised("DONE_LABEL").toUpperCase());
 IconUtils.setFontIcon("fa-check:16", doneButton);
 modifyingActionsWrapper.getChildren().addAll(NodeHelper.horizontalSpacer(), doneButton);
}

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

public FailurePanel() {
  this.getStyleClass().add("rightPane");
  this.setSpacing(10);
  this.failureNotification = new Label();
  this.failureNotification.setTextAlignment(TextAlignment.CENTER);
  this.failureReason = new Label();
  this.failureReason.setTextAlignment(TextAlignment.CENTER);
  this.retryButton = new Button(tr("Retry"));
  this.retryButton.getStyleClass().addAll("retryButton", "refreshIcon");
  this.getChildren().addAll(this.failureNotification, this.failureReason, this.retryButton);
}

相关文章