javafx.scene.text.Text.setText()方法的使用及代码示例

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

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

Text.setText介绍

暂无

代码示例

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

temp.applyCss();
double width = temp.getLayoutBounds().getWidth();
temp.setText(lineText.substring(0, beginIndex + queryLength));
temp.applyCss();
double maxX = temp.getLayoutBounds().getMaxX();

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

/**
 * {@inheritDoc}
 */
@Override
protected void layoutChildren(double contentX, double contentY, double contentWidth, double contentHeight) {
  final double strokeWidth = arc.getStrokeWidth();
  final double radius = Math.min(contentWidth, contentHeight) / 2 - strokeWidth / 2;
  final double arcSize = snapSize(radius * 2 + strokeWidth);
  arcPane.resizeRelocate((contentWidth - arcSize) / 2 + 1, (contentHeight - arcSize) / 2 + 1, arcSize, arcSize);
  updateArcLayout(radius, arcSize);
  fillRect.setWidth(arcSize);
  fillRect.setHeight(arcSize);
  if (!isValid) {
    initialize();
    isValid = true;
  }
  if (!getSkinnable().isIndeterminate()) {
    arc.setLength(arcLength);
    if (text.isVisible()) {
      final double progress = control.getProgress();
      int intProgress = (int) Math.round(progress * 100.0);
      Font font = text.getFont();
      text.setFont(Font.font(font.getFamily(), radius / 1.7));
      text.setText((progress > 1 ? 100 : intProgress) + "%");
      text.relocate((arcSize - text.getLayoutBounds().getWidth()) / 2, (arcSize - text.getLayoutBounds().getHeight()) / 2);
    }
  }
}

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

void updateIcon(FontIcon icon, Font font) {
  // System.err.println("UPDATE ICON " + icon.getIconName() + " / " +
  // font);
  this.text.setText(convert(icon, font));
}

代码示例来源:origin: com.thelastcheck.commons/tlc-commons-base

@Override
  public void handle(ActionEvent e) {
    messageText.setFill(Color.FIREBRICK);
    messageText.setText("Write to file...");
    if (isValidData()) {
      writeToFile();
    }
  }
});

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

@Override
public void setText(String text) {
  Platform.runLater(() -> progressText.setText(text));
}

代码示例来源:origin: org.jrebirth.af/preloader

/**
   * {@inheritDoc}
   */
  @Override
  public void handleApplicationNotification(final PreloaderNotification n) {
    if (n instanceof MessageNotification) {
      this.messageText.setText(((MessageNotification) n).getMessage());
    } else if (n instanceof ProgressNotification) {
      handleProgressNotification((ProgressNotification) n);
    }
  }
}

代码示例来源:origin: org.jrebirth/preloader

/**
 * {@inheritDoc}
 */
@Override
public void handleApplicationNotification(final PreloaderNotification n) {
  if (n instanceof MessageNotification) {
    this.messageText.setText(((MessageNotification) n).getMessage());
  } else if (n instanceof ProgressNotification) {
    handleProgressNotification((ProgressNotification) n);
  }
}

代码示例来源:origin: org.jrebirth.af.showcase/workbench

@Override
protected void initSimpleView() {
  node().setText(object());
}

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

private void rebuildText(String text) {
  for (Text t : this.activeLetters) {
    this.cache.releaseElement(t);
  }
  this.activeLetters.clear();
  for( char c : processText(text).toCharArray() ) {
    Text textNode = this.cache.getElement();
    textNode.setText(toString(c));
    this.activeLetters.add(textNode);
  }
}

代码示例来源:origin: org.jfxtras/jfxtras-window

public void setTitle(String title) {
  getLabel().setText(title);
  originalTitleWidth = getLabel().getBoundsInParent().getWidth();
  double maxIconWidth = Math.max(
      leftIconPane.getWidth(), rightIconPane.getWidth());
  if (originalTitleWidth
      + maxIconWidth * 2 + offset >= getWidth()) {
    getLabel().setText("...");
  }
}

代码示例来源:origin: org.processing/core

@Override
protected float textWidthImpl(char[] buffer, int start, int stop) {
 if (textFont == null) {
  defaultFontOrDeath("textWidth");
 }
 if (textFontInfo.font == null) {
  return super.textWidthImpl(buffer, start, stop);
 }
 fontCache.measuringText.setFont(textFontInfo.font);
 fontCache.measuringText.setText(new String(buffer, start, stop - start));
 return (float) fontCache.measuringText.getLayoutBounds().getWidth();
}

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

void updateIcon(FontIcon icon, double size) {
    this.text.setFont(Font.font(icon.getFont().getFamily(), size));
    this.text.setText(Character.toString(icon.getIconCode()));
  }
}

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

double computeTextWidth(Font font, String text, double wrappingWidth) {
  Text helper = new Text();
  helper.setFont(font);
  helper.setText(text);
  // Note that the wrapping width needs to be set to zero before
  // getting the text's real preferred width.
  helper.setWrappingWidth(0);
  helper.setLineSpacing(0);
  double w = Math.min(helper.prefWidth(-1), wrappingWidth);
  helper.setWrappingWidth((int)Math.ceil(w));
  return Math.ceil(helper.getLayoutBounds().getWidth());
}

代码示例来源:origin: com.powsybl/powsybl-gse-util

public void setCount(int count) {
    text.setText(Integer.toString(count));
    double height = text.getBoundsInLocal().getHeight();
    double width = Math.max(text.getBoundsInLocal().getWidth(), height);
    r1.setWidth(width * 1.3);
    r1.setHeight(height * 1.3);
    r2.setWidth(width * 1.2);
    r2.setHeight(height * 1.2);
  }
}

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

/**
 * Constructor
 */
public ErrorPane() {
 rootContainer.setStyle("-fx-background-color: white; " + "-fx-alignment:CENTER;");
 getChildren().add(rootContainer);
 NodeHelper.setHVGrow(rootContainer);
 iconContainer.getChildren().add(icon);
 iconContainer.setStyle("-fx-background-color:white;" + "-fx-alignment:CENTER_LEFT;" + "-icons-color:red");
 label.setText("Oups, error occurs when laoding data :-(.\nIf the problem persist, please contact you admin.");
 label.setStyle("-fx-font-family:'Robotom Medium'; " + "-fx-font-size: 1.4em;" + "-fx-fill:-text-color-900;");
 rootContainer.getChildren().addAll(iconContainer, label, NodeHelper.horizontalSpacer());
}

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

public static void addDescription(TextFlow flow, VLViewComponentXML configuration, AbstractViewController controller) {
 final Text labeled = new Text();
 final String descLabel = configuration.getPropertyValue(XMLConstants.DESCRIPTION);
 if (StringUtils.isNotBlank(descLabel)) {
  final String translated = controller.getLocalised(descLabel, configuration);
  labeled.setText(translated);
 }
 final String style = configuration.getPropertyValue("descriptionStyleClass");
 if (StringUtils.isNotBlank(style)) {
  labeled.getStyleClass().addAll(style.split(","));
 }
 flow.getChildren().add(labeled);
}

代码示例来源:origin: org.jrebirth.af/preloader

/**
 * {@inheritDoc}
 */
@Override
public void handleProgressNotification(final ProgressNotification pn) {
  if (this.jrebirthInitialized && pn.getProgress() >= 0.0 && pn.getProgress() <= 1.0) {
    this.progressBar.setProgress(pn.getProgress());
  } else {
    this.messageText.setText(getMessageFromCode((int) pn.getProgress()));
  }
}

代码示例来源:origin: org.jrebirth/preloader

/**
 * {@inheritDoc}
 */
@Override
public void handleProgressNotification(final ProgressNotification pn) {
  if (this.jrebirthInitialized && pn.getProgress() >= 0.0 && pn.getProgress() <= 1.0) {
    this.progressBar.setProgress(pn.getProgress());
  } else {
    this.messageText.setText(getMessageFromCode((int) pn.getProgress()));
  }
}

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

double computeTextHeight(Font font, String text, double wrappingWidth, double lineSpacing) {
  Text helper = new Text();
  helper.setFont(font);
  helper.setText(text);
  helper.setWrappingWidth((int)wrappingWidth);
  helper.setLineSpacing(lineSpacing);
  return helper.getLayoutBounds().getHeight();
}
/**

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

/**
 * @{inheritedDoc}
 */
@Override
public void build(IInputComponentWrapper inputComponentWrapper) {
 super.build(inputComponentWrapper);
 NodeHelper.styleClassAddAll(label, getConfiguration(), "viewStyleClass", "form-info-value");
 String curVal = inputComponentWrapper.getCurrentInternalValue();
 label.setText(curVal);
 Bindings.bindBidirectional(label.textProperty(), inputComponentWrapper.currentInternalValueProperty(), inputComponentWrapper.getConverter());
}

相关文章