javafx.scene.web.WebView.setPrefHeight()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(215)

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

WebView.setPrefHeight介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

private void expandToContentHeight() {
  try {
    WebView webView = getWebview();

    String heightText = webView.getEngine().executeScript("document.body.offsetHeight").toString();
    double height = Double.valueOf(heightText.replace("px", ""));
    Platform.runLater(new Runnable() {

      @Override
      public void run() {
        System.out.println(height);
        if (height != 0.0)
          webView.setPrefHeight(height);

      }
    });
  }
  catch (Exception ex) {
    LOG.error(ex);
    LOG.debug("Error occurred in method expandToContentHeight");
  }

}

代码示例来源:origin: org.beryx.viewreka/viewreka-fxui

/**
 * @param chartParentPane that should contain the {@link WebView} used by this chart controller
 * @param webEngineConsumer a {@link WebEngine} consumer that knows how to retrieve the content to be displayed, without relying on the value returned by {@link #createChartData()}
 */
public HtmlChartController(Pane chartParentPane, Consumer<WebEngine> webEngineConsumer) {
  this.webEngineConsumer = webEngineConsumer;
  chartParentPane.getChildren().add(webView);
  chartParentPane.widthProperty().addListener((obs, oldVal, newVal) -> {webView.setPrefWidth(newVal.doubleValue());});
  chartParentPane.heightProperty().addListener((obs, oldVal, newVal) -> {webView.setPrefHeight(newVal.doubleValue());});
}

代码示例来源:origin: com.github.vatbub/common.view.motd

double height = new Double(i);
height = height + 20;
rssWebView.setPrefHeight(height);
rssWebView.getPrefHeight();

相关文章