Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package fxdemo6;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.layout.Pane;
- import javafx.scene.layout.VBox;
- import javafx.scene.web.WebEngine;
- import javafx.scene.web.WebView;
- import javafx.stage.Stage;
- public class FXDemo6 extends Application {
- WebEngine wEngine;
- //
- public static void main(String[] args) {
- // TODO code application logic here
- launch(args);
- }
- // FlowPane pane = new FlowPane();
- private Pane createPane(){
- Pane pane = new VBox();
- // создаем элементы управления
- Button btn1 = new Button("Show");
- btn1.setOnAction(this::onClickButtonAction);
- pane.getChildren().add(btn1);
- // WebView -
- WebView browser = new WebView();
- wEngine = browser.getEngine();
- // добавляем браузер в панель
- pane.getChildren().add(browser);
- return pane;
- }
- private void onClickButtonAction(ActionEvent t) {
- System.out.println("onClickButtonAction>>");
- wEngine.load("https://oracle.com");
- System.out.println("<<");
- }
- @Override
- public void start(Stage stage) throws Exception {
- //
- System.out.println("FXDemo6.start>>");
- // создаем сцену (объект типа Scene)
- Scene scene = new Scene(createPane(), 1024, 680);
- // заголовок окна (подмостка)
- stage.setTitle("FXDemo6 - WebView!!!");
- stage.setScene(scene);
- // показ окна на экране
- stage.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement