本文整理汇总了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());
}
示例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();
}
示例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);
}
}
示例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));
}
}
示例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();
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}
});
}
示例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);
}
示例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);
}
示例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();
}