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

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

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

Label.setBackground介绍

暂无

代码示例

代码示例来源: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.bitplan.radolan/com.bitplan.radolan

/**
 * create a zoom for the given display Context
 * 
 * @param displayContext
 */
public Zoom(DisplayContext displayContext, int zoomFactor) {
 this.zoomFactor = zoomFactor;
 this.displayContext = displayContext;
 zoomImage = new WritableImage((int) displayContext.zoomKm * zoomFactor,
   (int) displayContext.zoomKm * zoomFactor);
 zoomView = new MapView(zoomImage);
 // zoomView.setFitWidth(zoomImage.getWidth());
 // zoomView.setFitHeight(zoomImage.getHeight());
 infoLabel = new Label("no info");
 infoLabel.setTextFill(Color.BLUE);
 infoLabel.setBackground(new Background(
   new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
 vbox = new VBox(infoLabel, zoomView.getStackPane());
 popOver = new PopOver(vbox);
}

相关文章