use of javafx.scene.web.WebView in project L42 by ElvisResearchGroup.
the class Frame method initWeb.
private Void initWeb(CountDownLatch latch, JFXPanel jfxPanel, String html) {
Group root = new Group();
Scene scene = new Scene(root);
WebView browser = new WebView();
this.webEngine = browser.getEngine();
this.webEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
if (newState == Worker.State.SUCCEEDED) {
latch.countDown();
}
});
this.webEngine.loadContent(html);
this.webEngine.setOnAlert(event -> {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Information Dialog");
alert.setHeaderText(null);
alert.setContentText(event.getData());
alert.showAndWait();
});
root.getChildren().add(browser);
jfxPanel.setScene(scene);
return null;
}
use of javafx.scene.web.WebView in project jabref by JabRef.
the class MathSciNetPaneView method getPane.
StackPane getPane() {
StackPane root = new StackPane();
ProgressIndicator progress = new ProgressIndicator();
progress.setMaxSize(100, 100);
WebView browser = new WebView();
// Quick hack to disable navigating
browser.addEventFilter(javafx.scene.input.MouseEvent.ANY, javafx.scene.input.MouseEvent::consume);
browser.setContextMenuEnabled(false);
root.getChildren().addAll(browser, progress);
mathSciNetId.getExternalURI().ifPresent(url -> browser.getEngine().load(url.toASCIIString()));
// Hide progress indicator if finished (over 70% loaded)
browser.getEngine().getLoadWorker().progressProperty().addListener((observable, oldValue, newValue) -> {
if (newValue.doubleValue() >= 0.7) {
progress.setVisible(false);
}
});
return root;
}
use of javafx.scene.web.WebView in project POL-POM-5 by PlayOnLinux.
the class StepRepresentationHtmlPresentation method drawStepContent.
@Override
protected void drawStepContent() {
final String title = this.getParentWizardTitle();
VBox contentPane = new VBox();
contentPane.setId("presentationBackground");
Label titleWidget = new Label(title + "\n\n");
titleWidget.setId("presentationTextTitle");
WebView webView = new WebView();
VBox.setVgrow(webView, Priority.ALWAYS);
webView.getEngine().loadContent(htmlToShow);
final URL style = getClass().getResource(String.format("/org/phoenicis/javafx/themes/%s/description.css", getParent().getThemeManager().getCurrentTheme().getShortName()));
webView.getEngine().setUserStyleSheetLocation(style.toString());
contentPane.getChildren().addAll(webView);
getParent().getRoot().setCenter(contentPane);
}
use of javafx.scene.web.WebView in project intellij-plugins by StepicOrg.
the class StudyBrowserWindow method initComponents.
private void initComponents() {
Platform.runLater(() -> {
pane = new StackPane();
webComponent = new WebView();
engine = webComponent.getEngine();
pane.getChildren().add(webComponent);
initHyperlinkListener();
initConsoleListener();
Scene scene = new Scene(pane);
panel.setScene(scene);
panel.setVisible(true);
updateLaf(LafManager.getInstance().getCurrentLookAndFeel() instanceof DarculaLookAndFeelInfo);
});
add(panel, BorderLayout.CENTER);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
}
use of javafx.scene.web.WebView in project Gargoyle by callakrsos.
the class SimpleTextView method miOpenNamoWebViewOnAction.
/**
* Mime 데이터타입을 Html컨텐츠형태로 조회하기 위한 웹 뷰를 오픈함.
* @작성자 : KYJ
* @작성일 : 2016. 12. 29.
*/
@FXML
public void miOpenNamoWebViewOnAction() {
String content = codeArea.getText();
try {
WebView webView = new WebView();
// new ContentMimeHtmlAdapter(content)
// String encodeToString = Base64.getEncoder().encodeToString(content.getBytes());
//
// byte[] decode = Base64.getDecoder().decode(encodeToString);
// String string = new String(decode);
// MimeBodyPart part = new MimeBodyPart(new ByteArrayInputStream(content.getBytes()));
// Enumeration allHeaders = part.getAllHeaders();
// while(allHeaders.hasMoreElements())
// {
// javax.mail.Header nextElement = (Header) allHeaders.nextElement();
//
// System.out.println(nextElement.getName());
// System.out.println(nextElement.getValue());
// }
//
// DataHandler dataHandler = part.getDataHandler();
// Object transferData = dataHandler.getTransferData(new DataFlavor("text/html"));
// System.out.println(transferData);
// ContentMimeHtmlAdapter adapter = new ContentMimeHtmlAdapter(content);
// File tempFile = adapter.toTempFile();
// byte[] decode = Base64.getMimeDecoder().decode(content.getBytes("UTF-8"));
// String string = new String(decode);
FxUtil.createStageAndShow(webView, stage -> {
stage.setAlwaysOnTop(true);
stage.initOwner(getScene().getWindow());
stage.focusedProperty().addListener((oba, o, n) -> {
if (!n)
stage.close();
});
});
javafx.application.Platform.runLater(() -> {
try {
MimeToHtmlAdapter adapter = new MimeToHtmlAdapter(content);
webView.getEngine().loadContent(adapter.getContent());
} catch (Exception e) {
e.printStackTrace();
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations