Java Code Examples for javafx.scene.web.WebView

The following examples show how to use javafx.scene.web.WebView. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: triplea   Source File: MapSelectionTest.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Test
void detailsButtonShowsDetails() throws Exception {
  final Node previewContainer = mock(Node.class);
  mapSelection.setPreviewContainer(previewContainer);

  final WebView previewWindow = mock(WebView.class);
  final var webEngine = mockWebEngine();
  when(previewWindow.getEngine()).thenReturn(webEngine);
  mapSelection.setPreviewWindow(previewWindow);

  final GameChooserEntry gameChooserEntry = mockGameChooserEntryWithNotes();
  mapSelection.setSelectedGame(gameChooserEntry);

  mapSelection.showDetails();

  verify(previewContainer).setVisible(true);
  verify(webEngine).loadContent(mapNotes.trim() + mapName);
}
 
Example 2
Source Project: AsciidocFX   Source File: SlidePane.java    License: Apache License 2.0 6 votes vote down vote up
@PostConstruct
public void afterInit() {
    threadService.runActionLater(() -> {
        getWindow().setMember("afx", controller);
        ReadOnlyObjectProperty<Worker.State> stateProperty = webEngine().getLoadWorker().stateProperty();
        WebView popupView = new WebView();
        Stage stage = new Stage();
        stage.initModality(Modality.WINDOW_MODAL);
        stage.setScene(new Scene(popupView));
        stage.setTitle("AsciidocFX");
        InputStream logoStream = SlidePane.class.getResourceAsStream("/logo.png");
        stage.getIcons().add(new Image(logoStream));
        webEngine().setCreatePopupHandler(param -> {
            if (!stage.isShowing()) {
                stage.show();
                popupView.requestFocus();
            }
            return popupView.getEngine();
        });
        stateProperty.addListener(this::stateListener);
    });
}
 
Example 3
Source Project: haxademic   Source File: VirtualCursor.java    License: MIT License 6 votes vote down vote up
public Browser(int w, int h) {
			this.w = w;
			this.h = h;
			thiss = this;
			webView = new WebView();
			webEngine = webView.getEngine();
			getChildren().add(webView);
			//apply the styles
//			getStyleClass().add("browser");
			// load the web page
			
			// load page & attach js bridge to call up to java
			P.println(webEngine.getUserAgent());
			webEngine.load("http://192.168.1.3:3333/touchless/sdk/javascript/#mode=kiosk&customerId=hovercraft&deviceId=1234567890");

			P.out("Adding js callback!");
			JSObject win = (JSObject) webEngine.executeScript("window");
			win.setMember("native", thiss);
		}
 
Example 4
Source Project: CodenameOne   Source File: CN1CSSCLI.java    License: GNU General Public License v2.0 6 votes vote down vote up
private static void startImpl(Stage stage) throws Exception {
    System.out.println("Opening JavaFX Webview to render some CSS styles");
    web = new WebView();
    web.getEngine().getLoadWorker().exceptionProperty().addListener(new ChangeListener<Throwable>() {
        @Override
        public void changed(ObservableValue<? extends Throwable> ov, Throwable t, Throwable t1) {
            System.out.println("Received exception: "+t1.getMessage());
        }
    });
    
    Scene scene = new Scene(web, 400, 800, Color.web("#666670"));
    stage.setScene(scene);
    stage.show();
    synchronized(lock) {
        lock.notify();
    }
}
 
Example 5
Source Project: oim-fx   Source File: WebViewContextMenuTest.java    License: MIT License 6 votes vote down vote up
private void createContextMenu(WebView webView) {
	ContextMenu contextMenu = new ContextMenu();
	MenuItem reload = new MenuItem("Reload");
	reload.setOnAction(e -> webView.getEngine().reload());
	MenuItem savePage = new MenuItem("Save Page");
	savePage.setOnAction(e -> System.out.println("Save page..."));
	MenuItem hideImages = new MenuItem("Hide Images");
	hideImages.setOnAction(e -> System.out.println("Hide Images..."));
	contextMenu.getItems().addAll(reload, savePage, hideImages);

	webView.setOnMousePressed(e -> {
		if (e.getButton() == MouseButton.SECONDARY) {
			contextMenu.show(webView, e.getScreenX(), e.getScreenY());
		} else {
			contextMenu.hide();
		}
	});
}
 
Example 6
@Override
public void start(Stage primaryStage) throws Exception {
	// controls
	WebView webView = createWebView();
	Label urlLabel = createUrlLabel();
	CheckBox listenerAttachedBox = createListenerAttachedBox();
	CheckBox cancelEventBox = createCancelEventBox();

	// listener
	WebViewHyperlinkListener listener = event -> {
		showEventOnLabel(event, urlLabel);
		return cancelEventBox.isSelected();
	};
	manageListener(webView, listener, listenerAttachedBox.selectedProperty());

	// put together
	VBox box = new VBox(webView, listenerAttachedBox, cancelEventBox, urlLabel);
	java.net.CookieHandler.setDefault(null);
	Scene scene = new Scene(box);
	primaryStage.setScene(scene);
	primaryStage.show();
}
 
Example 7
Source Project: JImageHash   Source File: AlgorithmBenchmarker.java    License: MIT License 6 votes vote down vote up
/**
 * Spawn a full screen windows with a webview displaying the html content
 * 
 * @param stage       of the window
 * @param htmlContent the content to display
 */
private void spawnNewWindow(Stage stage, String htmlContent) {

	WebView webView = new WebView();
	webView.getEngine().loadContent(htmlContent);

	// Fullscreen

	Rectangle2D screen = Screen.getPrimary().getVisualBounds();

	double w = screen.getWidth();
	double h = screen.getHeight();
	Scene scene = new Scene(webView, w, h);
	stage.setTitle("Image Hash Benchmarker");
	stage.getIcons().add(new Image("imageHashLogo.png"));
	stage.setScene(scene);
	stage.show();
}
 
Example 8
Source Project: haxademic   Source File: Demo_VirtualCursor.java    License: MIT License 6 votes vote down vote up
protected void initWebView() {
	// build WebView & JavaFX components on JavaFX thread
	
	// init WebView component
	// load page & attach js bridge to call up to java
	webView = new WebView();  // webView.setDisable(true);	// disable keyboard/mouse
	webEngine = webView.getEngine();
	webEngine.load("http://192.168.1.3:3333/touchless/sdk/javascript/#mode=kiosk&customerId=hovercraft&deviceId=1234567890&debug=true");
	P.println("webEngine.getUserAgent()", webEngine.getUserAgent());
	
	// init js bridge with this class as the deletage
	JSObject win = (JSObject) webEngine.executeScript("window");
	win.setMember("native", this);
	
	// add WebView to FXPanel/JFrame
	Scene scene = new Scene(webView, jframe.getWidth(), jframe.getHeight(), Color.web("#666970"));
	fxPanel.setScene(scene);
	jframe.setContentPane(fxPanel);
	
	// set special window properties
	// fxPanel.setFocusable(false);
	// fxPanel.setFocusTraversalKeysEnabled(true);
	// fxPanel.requestFocus();
	// fxPanel.requestFocusInWindow();
}
 
Example 9
/**
 * Attaches/detaches the specified listener to/from the specified web view according to the specified property's
 * value.
 *
 * @param webView
 *            the {@link WebView} to which the listener will be added
 * @param listener
 *            the added listener
 * @param attachedProperty
 *            defines whether the listener is attached or not
 */
private static void manageListener(WebView webView, WebViewHyperlinkListener listener,
		BooleanProperty attachedProperty) {
	attachedProperty.set(true);
	ListenerHandle listenerHandle = WebViews.addHyperlinkListener(webView, listener);

	attachedProperty.addListener((obs, wasAttached, isAttached) -> {
		if (isAttached) {
			listenerHandle.attach();
			System.out.println("LISTENER: attached.");
		} else {
			listenerHandle.detach();
			System.out.println("LISTENER: detached.");
		}
	});
}
 
Example 10
Source Project: Learn-Java-12-Programming   Source File: HtmlWebView.java    License: MIT License 6 votes vote down vote up
public void start(Stage primaryStage) {
    try {
        WebView wv = new WebView();
        WebEngine we = wv.getEngine();
        String html = "<html><center><h2>Hello, world!</h2></center></html>";
        we.loadContent(html, "text/html");

        Scene scene = new Scene(wv, 200, 60);

        primaryStage.setTitle("My HTML page");
        primaryStage.setScene(scene);
        primaryStage.onCloseRequestProperty()
                .setValue(e -> System.out.println("Bye! See you later!"));
        primaryStage.show();
    } catch (Exception ex){
        ex.printStackTrace();
    }
}
 
Example 11
Source Project: mars-sim   Source File: DatePicker.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void initPicker(WebView webView) {
  // attach a handler for an alert function call which will set the DatePicker's date property.
  webView.getEngine().setOnAlert(new EventHandler<WebEvent<String>>() {
    @Override public void handle(WebEvent<String> event) {
      try { date.set(jQueryUiDateFormat.parse(event.getData())); } catch (ParseException e) { /* no action required */ }
    }
  });

  // place the webView holding the jQuery date picker inside this node.
  this.getChildren().add(webView);

  // monitor the date for changes and update the formatted date string to keep it in sync.
  date.addListener(new ChangeListener<Date>() {
    @Override public void changed(ObservableValue<? extends Date> observableValue, Date oldDate, Date newDate) {
      dateString.set(dateFormat.format(newDate));
    }
  });

  // workaround as I don't know how to size the stack to the size of the enclosed WebPane's html content.
  this.setMaxSize(330, 280);//307, 241);
}
 
Example 12
Source Project: SONDY   Source File: GlobalUI.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void about(){
    final Stage stage = new Stage();
    stage.setResizable(false);
    stage.initModality(Modality.WINDOW_MODAL);
    stage.initStyle(StageStyle.UTILITY);
    stage.setTitle("About SONDY");
    WebView webView = new WebView();
    webView.getEngine().loadContent(getReferences());
    webView.setMaxWidth(Main.columnWidthLEFT);
    webView.setMinWidth(Main.columnWidthLEFT);
    webView.setMaxHeight(Main.columnWidthLEFT);
    webView.setMinHeight(Main.columnWidthLEFT);
    Scene scene = new Scene(VBoxBuilder.create().children(new Label("SONDY "+Main.version),new Label("Main developper: Adrien Guille <[email protected]>"),webView).alignment(Pos.CENTER).padding(new Insets(10)).spacing(3).build());
    scene.getStylesheets().add("resources/fr/ericlab/sondy/css/GlobalStyle.css");
    stage.setScene(scene);
    stage.show();
}
 
Example 13
@Override
public void start(Stage primaryStage) {
    TextArea textArea = new TextArea();
    WebView webView = new WebView();
    WebEngine engine = webView.getEngine();

    EventStreams.valuesOf(textArea.textProperty())
            .successionEnds(Duration.ofMillis(500))
            .subscribe(html -> engine.loadContent(html));

    SplitPane root = new SplitPane();
    root.getItems().addAll(textArea, webView);
    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 14
Source Project: marathonv5   Source File: JavaFXWebViewElement.java    License: Apache License 2.0 6 votes vote down vote up
public static void init(Node source) {
    WebView webview = (WebView) source;
    if (webview.getProperties().get("marathon_player_installed") == null) {
        webview.getProperties().put("marathon_player_installed", Boolean.TRUE);
        WebEngine webEngine = webview.getEngine();
        if (webEngine.getLoadWorker().stateProperty().get() == State.SUCCEEDED) {
            loadScript(webview, webEngine);
        }
        webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
            @Override
            public void changed(ObservableValue<? extends State> ov, State oldState, State newState) {
                if (newState == State.SUCCEEDED) {
                    loadScript(webview, webEngine);
                }
            }
        });
    }
}
 
Example 15
Source Project: marathonv5   Source File: RFXWebView.java    License: Apache License 2.0 6 votes vote down vote up
private void init(Node source) {
    WebView webview = (WebView) source;
    if (webview.getProperties().get("marathon_listener_installed") == null) {
        webview.getProperties().put("marathon_listener_installed", Boolean.TRUE);
        WebEngine webEngine = webview.getEngine();
        if (webEngine.getLoadWorker().stateProperty().get() == State.SUCCEEDED) {
            loadScript(webview);
        }
        webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
            @Override
            public void changed(ObservableValue<? extends State> ov, State oldState, State newState) {
                if (newState == State.SUCCEEDED) {
                    loadScript(webview);
                }
            }
        });
    }
    JavaFXWebViewElement.init(source);
}
 
Example 16
Source Project: mars-sim   Source File: WebViewDemo.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void start(Stage primaryStage) {

    StackPane root = new StackPane();
    WebView x = new WebView();
    WebEngine ex = x.getEngine();
    ex.load("https://github.com/travis-ci/travis-ci");

    root.getChildren().add(x);
    java.net.CookieHandler.setDefault(null);
    Scene scene = new Scene(root, 1024, 768);

    primaryStage.setTitle("Hello World!");
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 17
Source Project: netbeans   Source File: DialogsTest.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass(timeOut = 9000)
public static void initializeContext() throws Exception {
    final JFXPanel p = new JFXPanel();
    final URL u = DialogsTest.class.getResource("/org/netbeans/api/htmlui/empty.html");
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            WebView v = new WebView();
            Scene s = new Scene(v);
            p.setScene(s);
            HtmlToolkit.getDefault().load(v, u, new Runnable() {
                @Override
                public void run() {
                    ctx = BrwsrCtx.findDefault(DialogsTest.class);
                    down.countDown();
                }
            }, null);
        }
    });
    down.await();
    JFrame f = new JFrame();
    f.getContentPane().add(p);
    f.pack();
    f.setVisible(true);
}
 
Example 18
Source Project: phoebus   Source File: WelcomeInstance.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private Node createContent()
{
    browser = new WebView();
    final WebEngine engine = browser.getEngine();

    String url = Preferences.welcome;
    if (url.isEmpty())
    {
        final URL resource = getClass().getResource("welcome.html");
        url = resource.toExternalForm();
    }
    logger.log(Level.CONFIG, "Welcome URL: " + url);
    engine.load(url);

    return browser;
}
 
Example 19
Source Project: phoebus   Source File: HelpBrowser.java    License: Eclipse Public License 1.0 6 votes vote down vote up
HelpBrowser(final AppDescriptor app)
{
    this.app = app;

    browser = new WebView();
    dock_item = new DockItem(this, new BorderPane(browser))
    {
        // Add 'Web URL'
        @Override
        protected void fillInformation(final StringBuilder info)
        {
            super.fillInformation(info);
            info.append("\n");
            info.append(Messages.HelpPage).append(browser.getEngine().getLocation());
        }
    };
    dock_item.addClosedNotification(this::dispose);
    DockPane.getActiveDockPane().addTab(dock_item);

    JobManager.schedule(app.getDisplayName(), this::loadHelp);
}
 
Example 20
Source Project: xJavaFxTool-spring   Source File: IndexService.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @Title: addWebView
 * @Description: 添加WebView视图
 */
public void addWebView(String title, String url, String iconPath) {
    WebView browser = new WebView();
    WebEngine webEngine = browser.getEngine();
    if (url.startsWith("http")) {
        webEngine.load(url);
    } else {
        webEngine.load(IndexController.class.getResource(url).toExternalForm());
    }
    if (indexController.getSingleWindowBootCheckBox().isSelected()) {
        JavaFxViewUtil.getNewStage(title, iconPath, new BorderPane(browser));
        return;
    }
    Tab tab = new Tab(title);
    if (StringUtils.isNotEmpty(iconPath)) {
        ImageView imageView = new ImageView(new Image(iconPath));
        imageView.setFitHeight(18);
        imageView.setFitWidth(18);
        tab.setGraphic(imageView);
    }
    tab.setContent(browser);
    indexController.getTabPaneMain().getTabs().add(tab);
    indexController.getTabPaneMain().getSelectionModel().select(tab);
}
 
Example 21
private SplitPane createChartPane() {
    CategoryDataset3D dataset = SampleData.createCompanyRevenueDataset();
    Chart3D chart = AreaChart3DFXDemo1.createChart(dataset);
    Chart3DViewer viewer = new Chart3DViewer(chart);
  
    this.splitter = new SplitPane();
    splitter.setOrientation(Orientation.VERTICAL);
    final BorderPane borderPane = new BorderPane();
    borderPane.setCenter(viewer);
    
   // Bind canvas size to stack pane size.
    viewer.prefWidthProperty().bind(borderPane.widthProperty());
    viewer.prefHeightProperty().bind(borderPane.heightProperty());

    final StackPane sp2 = new StackPane();
    
    this.chartDescription = new WebView();
    WebEngine webEngine = chartDescription.getEngine();
    webEngine.load(AreaChart3DFXDemo1.class.getResource("AreaChart3DFXDemo1.html").toString());
    
    sp2.getChildren().add(chartDescription);  
    splitter.getItems().addAll(borderPane, sp2);
    splitter.setDividerPositions(0.70f, 0.30f);
    return splitter;
}
 
Example 22
Source Project: mars-sim   Source File: Browser.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void loadPage(TextField textField, //ProgressBar progressBar,
		WebEngine webEngine, WebView webView) {

	String route = textField.getText();
	if (route !=null)
		if (!route.substring(0, 7).equals("http://")) {
			route = "http://" + route;
			textField.setText(route);
		}

	System.out.println("Loading route: " + route);
	//progressBar.progressProperty().bind(webEngine.getLoadWorker().progressProperty());

	webEngine.getLoadWorker().stateProperty().addListener(new ChangeListener<State>() {
		@Override
		public void changed(ObservableValue<? extends State> value,
				State oldState, State newState) {
			if(newState == State.SUCCEEDED){
				System.out.println("Location loaded + " + webEngine.getLocation());
			}
		}
	});
	webEngine.load(route);


}
 
Example 23
public NodeInfoGUIPluginView(final NodeInfoGUIPluginModel model) {
	super(model, new FlowPane());
	Platform.runLater(() -> {
		WebView view = new WebView();
		FlowPane node = this.getNode();
		node.getChildren().add(view);
		this.webViewEngine = view.getEngine();
		this.webViewEngine.loadContent("<i>No node selected</i>");
	});
}
 
Example 24
Source Project: SubTitleSearcher   Source File: ExtractDialog.java    License: Apache License 2.0 5 votes vote down vote up
/**
	 * 打开网址
	 * 
	 * @param url
	 */
	private void openUrl(String url) {
		com.sun.javafx.webkit.WebConsoleListener.setDefaultListener((webView, message, lineNumber, sourceId) -> {
			logger.info("from webview: " + message + " [" + sourceId + " - " + lineNumber + "]");
		});
		Platform.runLater(new Runnable() {
			@Override
			public void run() {
				
				
				webview = new WebView();
				// webview.setContextMenuEnabled(false);

				WebEngine webEngine = webview.getEngine();

				webEngine.setJavaScriptEnabled(true);
				webEngine.setOnAlert(event -> jsAlert(event.getData()));
				webEngine.setConfirmHandler(message -> jsConfirm(message));

				webEngine.setOnError(event -> {
					logger.info(event.getMessage());
				});
//				webEngine.getLoadWorker().stateProperty().addListener((ov, oldState, newState) -> {
//					
//				});
				
				webviewScene = new Scene(webview);
				bsPanel.setScene(webviewScene);
				
				initData();
				webEngine.load(url);
				webview.getEngine().executeScript("window.serverPort="+AppConfig.serverPort+"");
				
			}
		});
	}
 
Example 25
Source Project: mars-sim   Source File: SwingFXWebView.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
     * createScene
     *
     * Note: Key is that Scene needs to be created and run on "FX user thread"
     *       NOT on the AWT-EventQueue Thread
     *
     */
    @SuppressWarnings("restriction")
	private void createScene() {
//        Platform.startup(new Runnable() {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {

                stage = new Stage();

                stage.setTitle("Hello Java FX");
                stage.setResizable(true);

                Group root = new Group();
                Scene scene = new Scene(root,80,20);
                stage.setScene(scene);

                // Set up the embedded browser:
                browser = new WebView();
                webEngine = browser.getEngine();
                webEngine.load("https://github.com/travis-ci/travis-ci");//https://sourceforge.net/p/mars-sim/discussion/");//"http://www.google.com");

                ObservableList<Node> children = root.getChildren();
                children.add(browser);

                jfxPanel.setScene(scene);
        }
    });
    }
 
Example 26
Source Project: jace   Source File: IdeController.java    License: GNU General Public License v2.0 5 votes vote down vote up
private Program createTab(DocumentType type, File document, boolean isBlank) {
    WebView editor = new WebView();
    Program proxy = new Program(type, globalOptions);
    proxy.initEditor(editor, document, isBlank);
    Tab t = new Tab(proxy.getName(), editor);
    tabPane.getTabs().add(t);
    openDocuments.put(t, proxy);
    t.setOnCloseRequest(this::handleCloseTabRequest);
    return proxy;
}
 
Example 27
Source Project: TerasologyLauncher   Source File: AboutViewController.java    License: Apache License 2.0 5 votes vote down vote up
private Optional<WebView> createViewFor(URL url) {
    switch (Files.getFileExtension(url.getFile().toLowerCase())) {
        case "md":
        case "markdown":
            return renderMarkdown(url);
        case "htm":
        case "html":
            return renderHtml(url);
        default:
            return renderUnknown(url);
    }

}
 
Example 28
Source Project: zap-extensions   Source File: BrowserPanel.java    License: Apache License 2.0 5 votes vote down vote up
private void createScene() {
    Platform.runLater(
            new Runnable() {
                @Override
                public void run() {
                    WebView view = new WebView();
                    view.setDisable(!enabled);
                    engine = view.getEngine();
                    listenToStateChangesForAdjustingPanelHeightToWebsite();
                    jfxPanel.setScene(new Scene(view));
                }
            });
}
 
Example 29
public static Alert create(final String title,
                           final String header,
                           final String htmlContent,
                           final String checkboxContentKey,
                           final PropertyContext context,
                           final String option
)
{
	GuiAssertions.assertIsNotJavaFXThread();
	Objects.requireNonNull(title);
	Objects.requireNonNull(header);
	Objects.requireNonNull(htmlContent);
	Objects.requireNonNull(context);
	Objects.requireNonNull(option);

	Alert alert = GuiUtility.runOnJavaFXThreadNow(() -> new Alert(Alert.AlertType.INFORMATION));
	alert.setTitle(title);
	alert.setContentText(null);
	alert.setHeaderText(header);
	CheckBox showLicense = new CheckBox(LanguageBundle.getString(checkboxContentKey));
	showLicense.selectedProperty().addListener((observableValue, oldValue, newValue) ->
               context.setBoolean(option, newValue));
	showLicense.setSelected(context.getBoolean(option));
	Platform.runLater(() -> {
		WebView webView = new WebView();
		webView.getEngine().loadContent(htmlContent);
		alert.getDialogPane().setContent(webView);
	});
	alert.getDialogPane().setExpandableContent(showLicense);
	return alert;
}
 
Example 30
Source Project: oim-fx   Source File: WebViewStyleTest.java    License: MIT License 5 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
	primaryStage.setTitle("What World");
	
	WebView webView = new WebView();
	WebPage webPage = null;
	WebEngine webEngine = webView.getEngine();

	webEngine.getLoadWorker().stateProperty().addListener((ObservableValue<? extends State> ov, State oldState, State newState) -> {
		System.out.println("loadWorker");
		if (newState == State.SUCCEEDED) {
			JSObject window = (JSObject) webEngine.executeScript("window");
			window.setMember("app", app);
			System.out.println("app");
		}
	});

	webPage = Accessor.getPageFor(webEngine);
	webPage.setJavaScriptEnabled(true);
	webPage.setEditable(false);
	webPage.setContextMenuEnabled(false);
	webView.setFocusTraversable(true);
	webView.getEngine().load(WebViewStyleTest.class.getResource("WebViewStyleTest.html").toExternalForm());

	BorderPane bp=new BorderPane();
	Scene scene = new Scene(bp);
	scene.getStylesheets().add(this.getClass().getResource("WebView.css").toString());
	bp.setCenter(webView);
	
	primaryStage.setScene(scene);
	primaryStage.show();
}