當前位置: 首頁>>代碼示例>>Java>>正文


Java WebEngine.loadContent方法代碼示例

本文整理匯總了Java中javafx.scene.web.WebEngine.loadContent方法的典型用法代碼示例。如果您正苦於以下問題:Java WebEngine.loadContent方法的具體用法?Java WebEngine.loadContent怎麽用?Java WebEngine.loadContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.web.WebEngine的用法示例。


在下文中一共展示了WebEngine.loadContent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initComponents

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
private void initComponents() {
    webView.setId("webView");
    webView.getEngine().getLoadWorker().stateProperty().addListener(new HyperlinkRedirectListener(webView));
    VBox.setVgrow(webView, Priority.ALWAYS);
    WebEngine engine = webView.getEngine();
    if (blurbInfo.getURL() != null)
        engine.load(blurbInfo.getURL().toExternalForm());
    else
        engine.loadContent(blurbInfo.getHtml());

    buttonBar.setId("buttonBar");
    buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
    buttonBar.getButtons().add(okButton);
    if (blurbInfo.isCancelNeeded()) {
        buttonBar.getButtons().add(cancelButton);
    }
    okButton.setOnAction((e) -> onOk());
    cancelButton.setOnAction((e) -> onCancel());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:Blurb.java

示例2: showOverview

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void showOverview() {
    if (!manager.isCatalogueLoaded() || (manager.groupList() == null || manager.groupList().isEmpty())) {
        return;
    }
    SimpleOverviewBuilder overview = new SimpleOverviewBuilder(manager.getCatalogue(), manager.groupList());
    String export = overview.exportOverviewHTML();
    WebView view = new WebView();
    WebEngine engine = view.getEngine();
    engine.loadContent(export);
    HBox box = new HBox();
    view.prefWidthProperty().bind(box.widthProperty());
    view.prefHeightProperty().bind(box.heightProperty());
    Scene webScene = new Scene(box, evaluator.getWidth(), evaluator.getHeight());
    box.prefWidthProperty().bind(webScene.widthProperty());
    box.prefHeightProperty().bind(webScene.heightProperty());
    box.getChildren().add(view);
    PopupStage popupStage = new PopupStage("Overview", webScene);
    popupStage.showAndWait();
}
 
開發者ID:dbisUnibas,項目名稱:ReqMan,代碼行數:20,代碼來源:EvaluatorHandler.java

示例3: handleValidateButtonAction

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
@FXML
private void handleValidateButtonAction(ActionEvent event) {
    String s = StringEscapeUtils.unescapeHtml4(markdownToHtml(currentSourceText.getText()));
    if (MdConvertController.corrector == null) {
        MdConvertController.corrector = new Corrector();
    }
    try {
        String result = MdConvertController.corrector.checkHtmlContent(s);
        WebEngine webEngine = currentRenderView.getEngine();
        webEngine.loadContent("<!doctype html><html lang='fr'><head><meta charset='utf-8'><base href='"
                + MainApp.class.getResource("assets").toExternalForm() + "' /></head><body>" + result + "</body></html>");
        webEngine.setUserStyleSheetLocation(MainApp.class.getResource("assets/static/css/content.css").toExternalForm());
    } catch (DOMException e) {
        log.error(e.getMessage(), e);
    }
}
 
開發者ID:firm1,項目名稱:zest-writer,代碼行數:17,代碼來源:MdTextController.java

示例4: toggleWebView

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void toggleWebView(){
    if(webViewBox.isVisible()){
        webViewBox.setVisible(false);
        documentText.setVisible(true);
        documentTitle.setVisible(true);
        webViewBox.setPrefWidth(0);
        webViewBox.setPrefHeight(0);
    }
    else{
        webViewBox.setVisible(true);
        documentText.setVisible(false);
        documentTitle.setVisible(false);
        webViewBox.setPrefWidth(1500);
        webViewBox.setPrefHeight(1500);
        WebEngine engine = webViewBox.getEngine();
        System.out.println("Loading " + saveDocument(documentText, documentTitle, false));
        engine.loadContent(saveDocument(documentText, documentTitle, false));
    }
}
 
開發者ID:chenshuiluke,項目名稱:notey,代碼行數:20,代碼來源:NoteyController.java

示例5: init

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public static void init()
{
    Stage stage = new Stage();
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.initOwner(MineIDE.primaryStage);
    stage.getIcons().add(new Image(Utils.IMG_DIR + "icon.png"));
    stage.setTitle("Credits");
    
    StackPane creditsVbox = new StackPane();
    
    WebView browser = new WebView();
    WebEngine webEngine = browser.getEngine();
    HtmlReader htmlReader = new HtmlReader();
    htmlReader.initReading(Utils.HTML_DIR + "credits.html");
    webEngine.loadContent(htmlReader.getOutputContent());
    
    creditsVbox.getChildren().add(browser);
    
    Scene scene = new Scene(creditsVbox, Gui.width / 1.5, Gui.height / 1.5);
    scene.setFill(Color.OLDLACE);
    
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();
}
 
開發者ID:Leviathan-Studio,項目名稱:MineIDE-UI,代碼行數:26,代碼來源:PopupCredits.java

示例6: start

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void start(Stage stage){
    WebView view = new WebView();
    WebEngine e = view.getEngine();
    e.loadContent("<div style='height: 50px; background-color: limegreen;'>Narrow div</div>");
    view.setMinHeight(MIN_HEIGHT);
    view.setId(VIEW_ID);

    VBox box = new VBox();
    box.setMaxHeight(MIN_HEIGHT - 10);
    box.setMinHeight(MIN_HEIGHT - 10);
    box.setPrefHeight(MIN_HEIGHT - 10);
    box.getChildren().add(view);

    final Scene scene = new Scene(box);
    stage.setTitle(VIEW_ID);
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();

    System.out.println(view.getHeight());
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:22,代碼來源:MinHeightTestApp.java

示例7: start

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void start(Stage stage){
    WebView view = new WebView();
    WebEngine e = view.getEngine();
    e.loadContent("<div style='width: 50px; background-color: limegreen;'>Narrow div</div>");
    view.setMinWidth(MIN_WIDTH);
    view.setId(VIEW_ID);

    HBox box = new HBox();
    box.setMaxWidth(MIN_WIDTH - 10);
    box.setMinWidth(MIN_WIDTH - 10);
    box.setPrefWidth(MIN_WIDTH - 10);
    box.getChildren().add(view);

    final Scene scene = new Scene(box);
    stage.setTitle(VIEW_ID);
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();

    System.out.println(view.getWidth());
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:22,代碼來源:MinWidthTestApp.java

示例8: start

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void start(Stage stage){
    WebView view = new WebView();
    WebEngine e = view.getEngine();
    e.loadContent("<div style='height: 1024px; width: 1024; background-color: limegreen;'>Big div</div>");
    view.setMaxSize(MAX_WIDTH, MAX_HEIGHT);
    view.setId(VIEW_ID);

    HBox box = new HBox();
    box.getChildren().add(view);

    final Scene scene = new Scene(box);
    stage.setTitle(VIEW_ID);
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();

    System.out.println("Width:" + view.getWidth());
    System.out.println("Height:" + view.getHeight());
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:20,代碼來源:MaxSizeTestApp.java

示例9: start

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void start(Stage stage){
    WebView view = new WebView();
    WebEngine e = view.getEngine();
    e.loadContent("<div style='height: 30px; width: 30; background-color: limegreen;'>Small div</div>");
    view.setMinSize(MIN_WIDTH, MIN_HEIGHT);
    view.setId(VIEW_ID);

    VBox box = new VBox();
    box.setMaxWidth(MIN_WIDTH - 10);
    box.setPrefWidth(MIN_WIDTH - 10);
    box.setMinWidth(MIN_WIDTH - 10);
    box.setMaxHeight(MIN_HEIGHT - 10);
    box.setPrefHeight(MIN_HEIGHT - 10);
    box.setMinHeight(MIN_HEIGHT - 10);

    box.getChildren().add(view);

    final Scene scene = new Scene(box);
    stage.setTitle(VIEW_ID);
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();

    System.out.println("Width:" + view.getWidth());
    System.out.println("Height:" + view.getHeight());
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:27,代碼來源:MinSizeTestApp.java

示例10: start

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void start(Stage stage){
    WebView view = new WebView();
    WebEngine e = view.getEngine();
    e.loadContent("<div style='width: 1024px; background-color: limegreen;'>Wide div</div>");
    view.setMaxWidth(MAX_WIDTH);
    view.setId(VIEW_ID);

    VBox box = new VBox();
    box.getChildren().add(view);

    final Scene scene = new Scene(box);
    stage.setTitle(VIEW_ID);
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();

    System.out.println(view.getWidth());
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:19,代碼來源:MaxWidthTestApp.java

示例11: start

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
public void start(Stage stage){
    WebView view = new WebView();
    WebEngine e = view.getEngine();
    e.loadContent("<div style='height: 1024px; background-color: limegreen;'>Tall div</div>");
    view.setMaxHeight(MAX_HEIGHT);
    view.setId(VIEW_ID);

    HBox box = new HBox();
    box.getChildren().add(view);

    final Scene scene = new Scene(box);
    stage.setTitle(VIEW_ID);
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();

    System.out.println(view.getHeight());
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:19,代碼來源:MaxHeightTestApp.java

示例12: loadContent

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
private void loadContent(WebView editor, AceMode aceMode)
{
    AceMode mode = aceMode;
    WebEngine engine = editor.getEngine();
    if (mode == null) mode = AceMode.JAVA;
    String strMode = "var mode = 'VALUE';\n{{mode-VALUE.js}}"
            .replaceAll("VALUE", mode.name().toLowerCase());
    engine.loadContent(readContent("ace.html", true, strMode));
    engine.getLoadWorker().stateProperty().addListener((observable, oldState, newState) ->
    {
        switch (newState)
        {
            case SUCCEEDED:
                JSObject js = (JSObject) engine.executeScript("window");
                gate = new AceJsGate(AceEditor.this, js);
                if (readyListener != null) readyListener.ready();
                break;
            default:
                break;
        }
    });
}
 
開發者ID:touwolf,項目名稱:bridje-framework,代碼行數:23,代碼來源:AceEditor.java

示例13: initComponents

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
private void initComponents() {
    webView.setId("webView");
    WebEngine engine = webView.getEngine();
    engine.loadContent(getWebViewContent(), "text/html");
    VBox.setVgrow(webView, Priority.ALWAYS);

    okButton.setOnAction((e) -> onOK());
    buttonBar.setId("buttonBar");
    buttonBar.getButtons().add(okButton);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:11,代碼來源:CreditsStage.java

示例14: initialize

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
@Override
	public void initialize(URL arg0, ResourceBundle arg1) {


String myvar = "<p><span style=\"color: #008080;\">IDBuilderFx</span> is a free desktop application built purely in JavaFx created for ease of Identity card creation which is more organised and consistent as compared to separately made Identity cards manually.</p>"+
"<p><span style=\"color: #008080;\">IDBuilderFx</span> works on essentially every popular platform. Challenge is to parse multiple resumes together which are in different types of formats and layouts and that too in a clean and efficient manner. It can read any type of resume in pdf format to give consistent Identity cards through evenly designed templates.</p>"+
"<p><span style=\"color: #008080;\"><em>Looking for a quick intro to IDBuilderFx?</em></span></p>"+
"<p>Check out a few quick tips to help you get started.</p>"+
"<ul>"+
"<li><strong>Login</strong> to your account from the right top corner login button on the home window to generate safe and secure outputs using confidential information of employees.</li>"+
"<li><strong>Browse for single or multiple resumes</strong> or CVs. Selecting one of the option will take you to the corresponding window (single or multiple) where you can choose the files.</li>"+
"<li>Next is <strong>Parser</strong> Click on Parse button to start parsing process and get the extracted data from the resumes.</li>"+
"<li>Get <strong>view of organised database </strong>in the form of an employee table.</li>"+
"<li><strong>Edit </strong>the details if required. <strong>Photos </strong>can be added or changed.</li>"+
"<li>Get to choose from <strong>attractive templates </strong>for Identity cards.</li>"+
"<li>In the <strong>Preview Template</strong> window, Enter the Organisation's name and select the output folder for the generated ID cards.</li>"+
"<li><strong>Generate! </strong>You can either view the output ID Cards or repeat to exploit more!</li>"+
"</ul>"+
"<hr />"+
"<p>�</p>"+
"<p>� Divyanshu Vishwakarma Mohammed Habeeb Ayushi Kakkar</p>"+
"<p><span style=\"color: #0000ff;\"><a href=\"https://github.com/djdivix/IDBuilderFX\">https://github.com/djdivix/IDBuilderFX</a></span></p>"+
"<p><span style=\"color: #000000;\">Email: [email protected]</span></p>"+
"<p>Contact : 9565484835</p>";
	

		WebEngine wEngine = wview.getEngine();
		wEngine.loadContent(myvar);
	}
 
開發者ID:djdivix,項目名稱:IDBuilderFX,代碼行數:30,代碼來源:HelpController.java

示例15: start

import javafx.scene.web.WebEngine; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
	VBox pane = new VBox(5.0d);
	WebView web = new WebView();
	WebEngine engine = web.getEngine();
	String content = new String(
			Files.readAllBytes(Paths.get(new URI(getClass().getResource("MMTestHTML.html").toString()))));
	engine.loadContent(content);
	System.out.println(content);
	pane.getChildren().add(web);
	Scene scene = new Scene(pane, 520, 320);
	stage.setScene(scene);
	stage.show();
}
 
開發者ID:shinsakamoto,項目名稱:practice-myanmar,代碼行數:15,代碼來源:MMTestFxWebView.java


注:本文中的javafx.scene.web.WebEngine.loadContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。