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

x33g5p2x  于2022-01-23 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(215)

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

Label.setFont介绍

暂无

代码示例

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

protected BorderPane createCalendarMonthLabelPane() {
  monthYearLabel = new Label();
  monthYearLabel.getStyleClass().add(SPINNER_LABEL);
  monthYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 13));
  monthYearLabel.setTextFill(DEFAULT_COLOR);
  BorderPane monthContainer = new BorderPane();
  monthContainer.setMinHeight(50);
  monthContainer.setCenter(monthYearLabel);
  monthContainer.setPadding(new Insets(2, 12, 2, 12));
  return monthContainer;
}

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

selectedHourLabel.getStyleClass().add(SPINNER_LABEL);
selectedHourLabel.setTextFill(Color.WHITE);
selectedHourLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
selectedHourLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.HOURS));
selectedHourLabel.setMinWidth(49);
selectedMinLabel.getStyleClass().add(SPINNER_LABEL);
selectedMinLabel.setTextFill(fadedColor);
selectedMinLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
selectedMinLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.MINUTES));
separatorLabel.setPadding(new Insets(0, 0, 4, 0));
separatorLabel.setTextFill(fadedColor);
separatorLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
periodPMLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
periodPMLabel.setOnMouseClicked((click) -> period.set("PM"));
periodAMLabel.getStyleClass().add(SPINNER_LABEL);
periodAMLabel.setTextFill(fadedColor);
periodAMLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
periodAMLabel.setOnMouseClicked((click) -> period.set("AM"));

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

selectedYearLabel.getStyleClass().add(SPINNER_LABEL);
selectedYearLabel.setTextFill(Color.rgb(255, 255, 255, 0.67));
selectedYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
selectedDateLabel.getStyleClass().add(SPINNER_LABEL);
selectedDateLabel.setTextFill(Color.WHITE);
selectedDateLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 32));

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

int val = ((i + 3) * 5) % 60;
Label label = new Label(String.valueOf(unitConverter.toString(val)));
label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));

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

label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
  val += (val == 12 ? -12 : 12);
  Label label = new Label(Integer.toString(val) + (val == 0 ? "0" : ""));
  label.setFont(Font.font(ROBOTO, FontWeight.NORMAL, 10));

代码示例来源:origin: com.cedarsoft.commons/javafx

@Nonnull
public static Label placeholder(@Nonnull String text) {
 Label placeholder = new Label(text);
 placeholder.setFont(new Font(30.0));
 placeholder.setTextFill(Color.gray(0.4));
 placeholder.setTextAlignment(TextAlignment.CENTER);
 placeholder.setAlignment(Pos.CENTER);
 placeholder.setStyle("-fx-background-color: #f8f8f8");
 return placeholder;
}

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

/**
 * Refresh the content to be displayed on the current page.
 */
private void updateDisplay() {
  clearContents();
  Page page = pages.get(currentPage);
  for (Line line : page.getLines()) {
    final Label l = new Label(line.getLine());
    l.getStyleClass().add(line.getStyleClass());
    if (line.getStyleClass().equals(PageSplitter.CENTERED_STYLE)){
      l.setFont(control.getCenteredFont());
      BorderPane centered = new BorderPane();
      centered.setCenter(l);
      contentContainer.getChildren().add(centered);
    } else {
      switch (line.getStyleClass()) {
        case PageSplitter.PARAGRAPH_STYLE:
          l.setFont(control.getParagraphFont());
          break;
        case PageSplitter.HEADING_STYLE:
          l.setFont(control.getHeaderFont());
          break;
        default:
          throw new IllegalStateException("Unknown style for font setting");
      }
      contentContainer.getChildren().add(l);
    }
  }
}
/**

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

protected BorderPane createCalendarMonthLabelPane() {
  monthYearLabel = new Label();
  monthYearLabel.getStyleClass().add(SPINNER_LABEL);
  monthYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 13));
  monthYearLabel.setTextFill(DEFAULT_COLOR);
  BorderPane monthContainer = new BorderPane();
  monthContainer.setMinHeight(50);
  monthContainer.setCenter(monthYearLabel);
  monthContainer.setPadding(new Insets(2, 12, 2, 12));
  return monthContainer;
}

代码示例来源:origin: com.guigarage/ui-basics

public static Label createLabel(String text, Character icon) {
  Label label = new Label(text);
  label.setTextFill(Color.GRAY);
  label.setFont(new Font(20));
  label.setGraphicTextGap(6);
  Text iconT = createIconText(icon, 24);
  iconT.setFill(Color.GRAY);
  label.setGraphic(iconT);
  return label;
}

代码示例来源:origin: ch.sahits.game/OpenPatricianJavaFX

/**
 * Create the labels and add them to the group.
 * @param g group the labels are added to
 * @param centerPoint central point around which the labels are placed.
 */
private void createAndAddLabels(Group g, final Point2D centerPoint) {
  List<String> values = control.valuesProperty();
  angles = new ArrayList<>(values.size());
  double angle = currentRotation.doubleValue() + 180;
  double step = (180.0 - 2 * currentRotation.doubleValue()) / (values.size() - 1);
  int radius = 120;
  for (String value : values) {
    angles.add(angle);
    Point2D basePoint = calculateBasePoint(centerPoint, radius, angle);
    Dimension2D dim = sizeing.calculate(value, control.getFont());
    Label l = new Label(value);
    l.setFont(control.getFont());
    l.getStyleClass().add("openPatricianSlider");
    l.setTranslateX(basePoint.getX() - dim.getWidth() * calculateMoveFactor(angle));
    l.setTranslateY(basePoint.getY() - dim.getHeight());
    g.getChildren().add(l);
    angle += step;
  }
  double initialAngle = Math.max(INITIAL_ROTATION, control.getSelectedIndex() * step);
  currentRotation.setValue(initialAngle);
}
/**

代码示例来源:origin: org.fxmisc.richtext/richtextfx

@Override
public Node apply(int idx) {
  Val<String> formatted = nParagraphs.map(n -> format(idx+1, n));
  Label lineNo = new Label();
  lineNo.setFont(DEFAULT_FONT);
  lineNo.setBackground(DEFAULT_BACKGROUND);
  lineNo.setTextFill(DEFAULT_TEXT_FILL);
  lineNo.setPadding(DEFAULT_INSETS);
  lineNo.setAlignment(Pos.TOP_RIGHT);
  lineNo.getStyleClass().add("lineno");
  // bind label's text to a Val that stops observing area's paragraphs
  // when lineNo is removed from scene
  lineNo.textProperty().bind(formatted.conditionOnShowing(lineNo));
  return lineNo;
}

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

selectedHourLabel.getStyleClass().add(SPINNER_LABEL);
selectedHourLabel.setTextFill(Color.WHITE);
selectedHourLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
selectedHourLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.HOURS));
selectedHourLabel.setMinWidth(49);
selectedMinLabel.getStyleClass().add(SPINNER_LABEL);
selectedMinLabel.setTextFill(fadedColor);
selectedMinLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
selectedMinLabel.setOnMouseClicked((click) -> unit.set(TimeUnit.MINUTES));
separatorLabel.setPadding(new Insets(0, 0, 4, 0));
separatorLabel.setTextFill(fadedColor);
separatorLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 42));
periodPMLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
periodPMLabel.setOnMouseClicked((click) -> period.set("PM"));
periodAMLabel.getStyleClass().add(SPINNER_LABEL);
periodAMLabel.setTextFill(fadedColor);
periodAMLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
periodAMLabel.setOnMouseClicked((click) -> period.set("AM"));

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

selectedYearLabel.getStyleClass().add(SPINNER_LABEL);
selectedYearLabel.setTextFill(Color.rgb(255, 255, 255, 0.67));
selectedYearLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 14));
selectedDateLabel.getStyleClass().add(SPINNER_LABEL);
selectedDateLabel.setTextFill(Color.WHITE);
selectedDateLabel.setFont(Font.font(ROBOTO, FontWeight.BOLD, 32));

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

int val = ((i + 3) * 5) % 60;
Label label = new Label(String.valueOf(unitConverter.toString(val)));
label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));

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

label.setFont(Font.font(ROBOTO, FontWeight.BOLD, 12));
  val += (val == 12 ? -12 : 12);
  Label label = new Label(Integer.toString(val) + (val == 0 ? "0" : ""));
  label.setFont(Font.font(ROBOTO, FontWeight.NORMAL, 10));

代码示例来源:origin: com.intuit.karate/karate-core

resultLabel.setTextFill(Color.web("#8c8c8c"));
resultLabel.setPadding(new Insets(3.0, 0, 0, 0));
resultLabel.setFont(new Font(15));
textArea.focusedProperty().addListener((val, before, after) -> {
  if (!after) { // if we lost focus

代码示例来源:origin: com.github.almasb/fxgl-ui

innerBar.setEffect(ds);
label.setFont(Font.font(16));
label.setTextFill(Color.GOLD);
label.textProperty().bind(currentValue.asString("%.0f").concat("/").concat(maxValue.asString("%.0f")));

代码示例来源:origin: com.github.almasb/fxgl-base

innerBar.setEffect(ds);
label.setFont(Font.font(16));
label.setTextFill(Color.GOLD);
label.textProperty().bind(currentValue.asString("%.0f").concat("/").concat(maxValue.asString("%.0f")));

代码示例来源:origin: GoMint/GoMint

public UiNoReportOpen() {
  this.setBackground( new Background( new BackgroundFill( ColorPalette.UI_BACKGROUND.getPaint(),
      null, null ) ) );
  this.goMintLogoView.setFitWidth( 150 );
  this.goMintLogoView.setFitHeight( 150 );
  this.performanceViewerTitle.setFont( Font.font( 20 ) );
  this.performanceViewerTitle.setTextFill( ColorPalette.UI_FOREGROUND.getPaint() );
  this.performanceViewerSubTitle.setTextFill( ColorPalette.UI_SECONDARY_FOREGROUND.getPaint() );
  VBox mainContainer = new VBox();
  HBox secondaryContainer = new HBox();
  VBox textContainer = new VBox();
  Pane separator = new Pane();
  separator.setPrefHeight( 2 );
  separator.setMaxWidth( 500 );
  separator.setBackground( new Background( new BackgroundFill( ColorPalette.UI_BACKGROUND_SECONDARY.getPaint(),
      null, null ) ) );
  mainContainer.setSpacing( 20 );
  mainContainer.setAlignment( Pos.CENTER );
  mainContainer.getChildren().addAll( new UiStatusUpdate( "Current build status | Bloody Edge" ),
      secondaryContainer, separator, new UiButton( "Open performance report" ) );
  secondaryContainer.setSpacing( 20 );
  secondaryContainer.setAlignment( Pos.CENTER );
  secondaryContainer.getChildren().addAll( this.goMintLogoView, textContainer );
  textContainer.setSpacing( 5 );
  textContainer.setAlignment( Pos.CENTER_LEFT );
  textContainer.getChildren().addAll( this.performanceViewerTitle, this.performanceViewerSubTitle );
  this.setAlignment( Pos.CENTER );
  this.getChildren().addAll( mainContainer );
}

相关文章