コード例 #1
1
ファイル: MainController.java プロジェクト: RetiredQQ/nanobot
 private void initFooter() {
   webView.getEngine().load(BuildInfo.instance().getAdUrl());
   webView
       .getEngine()
       .locationProperty()
       .addListener(
           (observable, oldValue, newValue) -> {
             if (BuildInfo.instance().getAdUrl().equals(oldValue)) {
               application.getHostServices().showDocument(newValue);
             }
           });
   final Thread reloadThread =
       new Thread(
           () -> {
             while (true) {
               try {
                 Thread.sleep(60000);
                 javafx.application.Platform.runLater(
                     () -> {
                       webView.getEngine().reload();
                     });
               } catch (final Exception e) {
                 logger.log(Level.FINE, "Refresh failed", e);
               }
             }
           },
           "AdvReloader");
   reloadThread.setDaemon(true);
   reloadThread.start();
 }
コード例 #2
0
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   api = new APIConnect();
   ValidatorBase require = new RequiredFieldValidator();
   require.setMessage("ユーザIDは必須");
   ValidatorBase validator = new UserValidator(api);
   validator.setMessage("無効なユーザID");
   userField.getValidators().addAll(require, validator);
   userField
       .focusedProperty()
       .addListener(
           (o, oldVal, newVal) -> {
             if (!newVal) userField.validate();
             setProblem();
           });
   postedCode
       .getEngine()
       .load(getClass().getResource("/resources/html/ace.html").toExternalForm());
   obj = (JSObject) postedCode.getEngine().executeScript("window");
   try {
     contest.getItems().addAll(api.getContests());
   } catch (Exception e) {
     getAlert(e, "コンテスト情報の取得に失敗しました。").show();
     return;
   }
 }
コード例 #3
0
 private void createWebView() {
   engine = webView.getEngine();
   webView
       .getEngine()
       .load(
           "file:///Users/angelacaicedo/Work/JavaFX/JavaOne/JavaFX-HOLs/solutions/exercise3/JavaFX-HTML5/src/javafx/html5/content.html");
 }
コード例 #4
0
 public void setClient(WebView view) {
   this.view = view;
   this.engine = view.getEngine();
   JSObject window = (JSObject) engine.executeScript("window");
   window.setMember("ide", this);
   Collection<IEclipseToBrowserFunction> onLoadFunctions =
       new ArrayList<IEclipseToBrowserFunction>();
   IConfigurationElement[] extensions =
       BrowserExtensions.getExtensions(
           BrowserExtensions.EXTENSION_ID_ECLIPSE_TO_BROWSER,
           null,
           view.getEngine().locationProperty().get());
   for (IConfigurationElement element : extensions) {
     try {
       String onLoad = element.getAttribute(BrowserExtensions.ELEMENT_ONLOAD);
       if (onLoad != null && onLoad.equals("true")) {
         onLoadFunctions.add(
             (IEclipseToBrowserFunction)
                 WorkbenchPlugin.createExtension(element, BrowserExtensions.ELEMENT_CLASS));
       }
     } catch (CoreException ex) {
       StatusManager.getManager()
           .handle(
               new Status(
                   IStatus.ERROR,
                   IdeUiPlugin.PLUGIN_ID,
                   "Could not instantiate browser element provider extension.",
                   ex));
       return;
     }
   }
   callOnBrowser(onLoadFunctions);
 }
コード例 #5
0
  /**
   * Sets up the GUI, ensuring that everything is loaded nicely.
   *
   * @param location
   * @param resources
   */
  public void initialize(URL location, ResourceBundle resources) {
    filter = new Filter();
    Set<String> books = new HashSet<>();
    for (Book book : Book.values()) {
      books.add(book.toString());
    }
    filter.setBooks(books);
    results.setItems(listItems);
    String index = "java_ebook_search/index";
    String home = "/java_ebook_search/view/index.html";

    try {
      search = new Search(index);
      commonTerms = TextFields.bindAutoCompletion(query, search.getAutocomplete());
      commonTerms.setVisibleRowCount(10);
      sc = new SpellCheck();
      webEngine = webView.getEngine();
      webEngine.load(getClass().getResource(home).toString());
      results
          .getSelectionModel()
          .selectedItemProperty()
          .addListener((observable, oldValue, newValue) -> loadResult(newValue));
    } catch (NullPointerException e) {
      System.out.println("It's happened again, ignore it");
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #6
0
ファイル: WebKitBrowser.java プロジェクト: sumitlakra/BurpKit
  private void createMasterPane() {
    webView = new WebView();

    webViewAnchorPane = new AnchorPane(webView);
    AnchorPane.setBottomAnchor(webView, 0.0);
    AnchorPane.setTopAnchor(webView, 0.0);
    AnchorPane.setLeftAnchor(webView, 0.0);
    AnchorPane.setRightAnchor(webView, 0.0);

    webEngine = webView.getEngine();

    dialog = Dialogs.create().lightweight().modal().owner(webView);

    //        locals = new LocalJSObject(webEngine);
    //        globals = GlobalJSObject.getGlobalJSObject(webEngine);
    javaScriptHelpers = new BurpKitBridge(webEngine);
    originalUserAgent = webEngine.getUserAgent();
    webEngine.setJavaScriptEnabled(true);
    webEngine.setOnAlert(this::handleAlert);
    webEngine.setOnError(this::handleError);
    webEngine.setConfirmHandler(param -> true);
    webEngine.getLoadWorker().stateProperty().addListener(this::workerStateChanged);

    createToolBar();

    createStatusBar();

    webEngine.load("about:blank");

    masterPane = new BorderPane();
    masterPane.setTop(toolBar);
    masterPane.setCenter(webViewAnchorPane);
    masterPane.setBottom(statusBar);
  }
コード例 #7
0
ファイル: AceEditor.java プロジェクト: dipu-bd/AceFX
  /** Initializes view and controls after FXML is loaded. */
  public void initialize() {
    // setup view
    webView.setContextMenuEnabled(false);
    mWebEngine = webView.getEngine();
    loadAceEditor();
    loadModeList();
    loadThemeList();

    // process page loading
    mWebEngine
        .getLoadWorker()
        .stateProperty()
        .addListener(
            new ChangeListener<Worker.State>() {
              @Override
              public void changed(
                  ObservableValue<? extends Worker.State> ov, Worker.State t, Worker.State t1) {
                if (mWebEngine.getLoadWorker().getState() == Worker.State.SUCCEEDED) {
                  // extract javascript objects
                  mAce = (JSObject) mWebEngine.executeScript("ace");
                  JSObject editor = (JSObject) mAce.call("edit", "editor");
                  mEditor = new Editor(editor);

                  setEventCatchers(editor);
                  setTheme(Themes.Chrome);
                  setMode(Modes.Text);

                  fireEvent(new Event(AceEvents.onLoadEvent));
                }
              }
            });
  }
コード例 #8
0
  private void initComponents() {
    Platform.runLater(
        () -> {
          myPane = new StackPane();
          myWebComponent = new WebView();
          myEngine = myWebComponent.getEngine();

          if (myShowProgress) {
            myProgressBar = makeProgressBarWithListener();
            myWebComponent.setVisible(false);
            myPane.getChildren().addAll(myWebComponent, myProgressBar);
          } else {
            myPane.getChildren().add(myWebComponent);
          }
          if (myLinkInNewBrowser) {
            initHyperlinkListener();
          }
          Scene scene = new Scene(myPane);
          myPanel.setScene(scene);
          myPanel.setVisible(true);
          updateLaf(
              LafManager.getInstance().getCurrentLookAndFeel() instanceof DarculaLookAndFeelInfo);
        });

    add(myPanel, BorderLayout.CENTER);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  }
コード例 #9
0
  @Override
  public void start(Stage primaryStage) {
    String url = handler.getConnectionUrl();

    WebView browser = new WebView();
    WebEngine webEngine = browser.getEngine();
    webEngine.load(url);

    StackPane root = new StackPane();
    root.getChildren().add(browser);

    Scene scene = new Scene(root, 650, 500);

    primaryStage.setTitle("Acces Token Getter");
    primaryStage.setScene(scene);
    primaryStage.show();

    primaryStage.setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          public void handle(WindowEvent we) {
            try {
              String urlWithAT = webEngine.getLocation();
              handler.setInputUrl(urlWithAT);
              handler.parseUrl();
              handler.writeAccesTokenToFile(OUTPUT_FILE_NAME);
              System.out.print("See file: " + OUTPUT_FILE_NAME);
            } catch (Exception e) {
              System.out.print(e.getMessage());
            }
          }
        });
  }
コード例 #10
0
ファイル: WelcomePart.java プロジェクト: DawnScience/dawn-ui
  @Override
  public void createPartControl(Composite container) {

    Platform.setImplicitExit(false); // Keep the JavaFX thread running

    // Creating a JavaFX Browser, so create an FXCanvas to contain it
    FXCanvas canvas = new FXCanvas(container, SWT.NONE);
    BorderPane borderPane = new BorderPane();
    Scene scene = new Scene(borderPane);

    WebView browser = new WebView();
    webEngine = browser.getEngine();
    webEngine.load(homeLocation);

    borderPane.setCenter(browser);

    canvas.setScene(scene);

    IActionBars actionBars = getIntroSite().getActionBars();
    IToolBarManager toolBar = actionBars.getToolBarManager();

    setupToolbarButtons(toolBar);
    lockUrl();
    addJSBridges();
  }
コード例 #11
0
  private void initPane() {
    //		WebEngine engine = optionView.getEngine();
    try {
      Document document = Jsoup.connect(webView.getEngine().getLocation()).get();
      Element table =
          document.select("#normal_basket_" + document.select("[name=item_id]").val()).first();
      Element td = table.select("td").first();
      Elements spans = td.select("span");
      Elements selects = td.select("select");
      //			System.out.println(spans.size());
      cmb = new ArrayList<ComboBox>();
      for (int i = 0; i < spans.size(); i++) {

        ObservableList<ValuePair> obs = FXCollections.observableArrayList();
        Elements options = selects.get(i).select("option");
        for (int k = 0; k < options.size(); k++) {
          Element option = options.get(k);
          obs.add(new ValuePair("choice", option.text(), option.val()));
        }

        cmb.add(new ComboBox<ValuePair>(obs));
        optionArea.getChildren().addAll(new Text(spans.get(i).text()), cmb.get(i));
      }

    } catch (Exception e) {
      // TODO 自動生成された catch ブロック
      e.printStackTrace();
    }
  }
コード例 #12
0
ファイル: PreviewManager.java プロジェクト: finanzer/epubfx
  public void setWebview(WebView webview) {
    this.webview = webview;

    webview
        .getEngine()
        .setOnError(
            event -> {
              logger.error(event.getMessage(), event.getException());
            });
    webview
        .getEngine()
        .setOnAlert(
            event -> {
              logger.info(event.getData());
            });
  }
コード例 #13
0
public class VueRegles extends GridPane {

  private defaultButton retour;
  private WebView browser = new WebView();
  private WebEngine webEngine = browser.getEngine();

  public VueRegles(Stage stage) {
    setHgap(10);
    setVgap(10);

    retour = new defaultButton("Retour");
    URL urlRegles = getClass().getResource("Règles.html");

    webEngine.load(urlRegles.toExternalForm());

    browser.setPrefHeight(850);
    browser.setPrefWidth(1400);

    TitledPane tp = new TitledPane("Règles du jeu", browser);
    tp.setCollapsible(false);
    add(tp, 0, 0);
    add(retour, 0, 1);
  }

  public defaultButton getRetour() {
    return retour;
  }
}
コード例 #14
0
 /**
  * Handle calls <i>from</i> Javascript functions on the browser. (This is called by reflection by
  * JavaFx so there won't be any apparent usages for this method.)
  *
  * @param functionId
  * @param argument
  */
 public void call(String functionId, String argument) {
   try {
     IConfigurationElement element =
         BrowserExtensions.getExtension(
             BrowserExtensions.EXTENSION_ID_BROWSER_TO_ECLIPSE,
             functionId,
             view.getEngine().locationProperty().get());
     if (element != null) {
       IBrowserToEclipseFunction function =
           (IBrowserToEclipseFunction)
               WorkbenchPlugin.createExtension(element, BrowserExtensions.ELEMENT_CLASS);
       function.call(argument);
     } else {
       StatusManager.getManager()
           .handle(
               new Status(
                   IStatus.ERROR,
                   IdeUiPlugin.PLUGIN_ID,
                   "Could not instantiate browser function extension: " + functionId));
     }
   } catch (CoreException ex) {
     StatusManager.getManager()
         .handle(
             new Status(
                 IStatus.ERROR, IdeUiPlugin.PLUGIN_ID, "Could not find dashboard extension", ex));
     return;
   }
 }
コード例 #15
0
 protected WebView getWebView() {
   if (engine == null) {
     webView = new WebView();
     webView.setContextMenuEnabled(false);
     engine = webView.getEngine();
   }
   return webView;
 }
コード例 #16
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    urlField.setOnAction(
        event -> {
          String text = urlField.getText();
          urlField.setText("tetetetetetetete");
          webView.getEngine().load(text);
        });

    webView
        .getEngine()
        .getLoadWorker()
        .stateProperty()
        .addListener(
            (ov, oldState, newState) -> {
              if (newState == State.SUCCEEDED) {
                String url = webView.getEngine().getLocation();
                urlField.setText(url);
                if (Pattern.compile("http://item.rakuten.co.jp/.*").matcher(url).find()) {
                  try {
                    Elements tmp;
                    Document document = Jsoup.connect(url).get();
                    tmp = document.select("input");
                    tmp = tmp.select("#etime");
                    if (tmp.size() != 0) {
                      if (!(Long.parseLong(tmp.first().val()) < new Date().getTime())) {
                        entryButton.setDisable(false);
                      }
                    } else {
                      entryButton.setDisable(false);
                    }
                  } catch (Exception e) {
                    // TODO 自動生成された catch ブロック
                    e.printStackTrace();
                  }
                }
              }
              ;
            });

    entryButton.setOnAction(
        event -> {
          urlField.setText("webView disable");
          sendEntryTaskController();
        });
  }
コード例 #17
0
 public void goToAddress() {
   String address = addressBar.getText();
   if (!address.startsWith("http")) {
     address = "http://" + address;
   }
   WebEngine engine = webView.getEngine();
   engine.load(address);
 }
コード例 #18
0
  public void goForward() {
    try {
      WebEngine engine = webView.getEngine();
      WebHistory history = engine.getHistory();
      history.go(1);
    } catch (Exception e) {

    }
  }
コード例 #19
0
ファイル: PreviewManager.java プロジェクト: finanzer/epubfx
 private void refreshWebView(Resource resource) {
   if (isVisible) {
     WebEngine engine = webview.getEngine();
     engine
         .getLoadWorker()
         .stateProperty()
         .addListener(
             (observable, oldValue, newValue) -> {
               if (newValue.equals(Worker.State.SUCCEEDED)) {
                 Document document = engine.getDocument();
                 Element documentElement = document.getDocumentElement();
                 if (documentElement != null) {
                   ((EventTarget) documentElement)
                       .addEventListener(
                           "click",
                           evt -> {
                             if (evt.getTarget() instanceof ElementImpl) {
                               Deque<ElementPosition> positions = new ArrayDeque<>();
                               ElementImpl currentElement = ((ElementImpl) evt.getTarget());
                               ElementImpl parent =
                                   (ElementImpl) currentElement.getParentElement();
                               while (parent != null) {
                                 NodeList children;
                                 if (StringUtils.isNotEmpty(currentElement.getNamespaceURI())) {
                                   children =
                                       parent.getElementsByTagNameNS(
                                           currentElement.getNamespaceURI(),
                                           currentElement.getNodeName());
                                 } else {
                                   children =
                                       parent.getElementsByTagName(currentElement.getNodeName());
                                 }
                                 for (int i = 0; i < children.getLength(); i++) {
                                   if (children.item(i) == currentElement) {
                                     ElementPosition position =
                                         new ElementPosition(
                                             currentElement.getNodeName(),
                                             i,
                                             currentElement.getNamespaceURI());
                                     positions.push(position);
                                   }
                                 }
                                 currentElement = parent;
                                 parent = (ElementImpl) currentElement.getParentElement();
                               }
                               editorManager.scrollTo(positions);
                             } else {
                               logger.info("clicked class " + evt.getTarget());
                             }
                           },
                           false);
                 }
               }
             });
     engine.load("http://localhost:8777/" + resource.getHref());
   }
 }
コード例 #20
0
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // TODO 自動生成されたメソッド・スタブ
    addOption.setOnAction(
        event -> {
          for (int i = 0; i < cmb.size(); i++) {
            //				System.out.println(cmb.get(i).getValue());
            if (cmb.get(i).getValue() == null) {
              break;
            } else if (i == cmb.size() - 1) {
              addTask.setDisable(false);
            }
          }
        });

    addTask.setOnAction(
        event -> {
          try {
            String url = webView.getEngine().getLocation();
            System.out.println(url);
            Document document = Jsoup.connect(url).get();

            Elements input = document.select("input");

            Map params = new HashMap<String, String>();
            for (ComboBox cmbx : cmb) {
              ValuePair vp = (ValuePair) cmbx.getValue();
              params.put(vp.getName(), vp.getvalue());
            }
            //				System.out.println(input.select("[name=shop_bid]").first());
            //				System.out.println(input.select("[name=shop_bid]").first().val());
            params.put("shop_bid", input.select("[name=shop_bid]").first().val());
            params.put("item_id", input.select("[name=item_id]").first().val());
            params.put("__event", input.select("[name=__event]").first().val());
            params.put("units", "1");

            Map map = new HashMap<String, Long>();

            //				System.out.println(document.select("#stime").size());
            if (document.select("#stime").size() != 0) {
              System.out.println(document.select("#stime"));
              map.put("stime", Long.parseLong((input.select("#stime").first().val())));
              map.put("etime", Long.parseLong((input.select("#etime").first().val())));
            } else {
              map = null;
            }

            BuyTask task = new BuyTask(url, params, map);
            task.call();
            this.getScene().getWindow().hide();
          } catch (Exception e) {
            // TODO 自動生成された catch ブロック
            e.printStackTrace();
          }
        });
  }
コード例 #21
0
  private ProgressBar makeProgressBarWithListener() {
    final ProgressBar progress = new ProgressBar();
    progress.progressProperty().bind(myWebComponent.getEngine().getLoadWorker().progressProperty());

    myWebComponent
        .getEngine()
        .getLoadWorker()
        .stateProperty()
        .addListener(
            (ov, oldState, newState) -> {
              if (myWebComponent.getEngine().getLocation().contains("http")
                  && newState == Worker.State.SUCCEEDED) {
                myProgressBar.setVisible(false);
                myWebComponent.setVisible(true);
              }
            });

    return progress;
  }
コード例 #22
0
ファイル: HelpVC.java プロジェクト: brandonho36/SLogo
 public void initializeWebView(double width, double height) {
   WebView browser = new WebView();
   String start = "file://";
   String workingDir = start + System.getProperty("user.dir");
   String url = workingDir + "/src/resources/commands.html";
   browser.getEngine().load(url);
   browser.setPrefSize(width, height);
   myScrollPane.setContent(browser);
   myPane.getChildren().add(myScrollPane);
 }
コード例 #23
0
ファイル: PreviewManager.java プロジェクト: finanzer/epubfx
 public void setEditorManager(EditorTabManager editorManager) {
   editorManager
       .currentXHTMLResourceProperty()
       .addListener((observable, oldValue, newValue) -> refreshWebView(newValue));
   editorManager
       .needsRefreshProperty()
       .addListener(
           (observable, oldValue, newValue) -> {
             if (newValue) {
               logger.info("getting reload event from needs refresh property");
               webview.getEngine().reload();
             }
           });
   this.editorManager = editorManager;
 }
コード例 #24
0
  public JavaFxHtmlPanel() {
    // System.setProperty("prism.lcdtext", "false");
    // System.setProperty("prism.text", "t2k");
    myPanelWrapper = new JPanel(new BorderLayout());
    myPanelWrapper.setBackground(JBColor.background());

    ApplicationManager.getApplication()
        .invokeLater(
            () ->
                PlatformImpl.startup(
                    () -> {
                      myWebView = new WebView();

                      updateFontSmoothingType(
                          myWebView,
                          MarkdownApplicationSettings.getInstance()
                              .getMarkdownPreviewSettings()
                              .isUseGrayscaleRendering());
                      myWebView.setContextMenuEnabled(false);

                      final WebEngine engine = myWebView.getEngine();
                      engine.getLoadWorker().stateProperty().addListener(myBridgeSettingListener);
                      engine
                          .getLoadWorker()
                          .stateProperty()
                          .addListener(myScrollPreservingListener);

                      final Scene scene = new Scene(myWebView);

                      ApplicationManager.getApplication()
                          .invokeLater(
                              () -> {
                                myPanel = new JFXPanelWrapper();
                                myPanel.setScene(scene);

                                setHtml("");
                                for (Runnable action : myInitActions) {
                                  Platform.runLater(action);
                                }
                                myInitActions.clear();

                                myPanelWrapper.add(myPanel, BorderLayout.CENTER);
                                myPanelWrapper.repaint();
                              });
                    }));

    subscribeForGrayscaleSetting();
  }
コード例 #25
0
ファイル: WebBrowser.java プロジェクト: M-Sayed/Gravity-OS
  // Adding functionality to the forward button
  public String goForward() {
    final WebHistory history = browser.getEngine().getHistory();
    ObservableList<WebHistory.Entry> entryList = history.getEntries();
    int currentIndex = history.getCurrentIndex();

    Platform.runLater(() -> history.go(1));
    if (currentIndex < entryList.size() - 2) {
      entryList.get(currentIndex + 1);
      forwardButton.setDisable(false);
    } else {
      entryList.get(history.getCurrentIndex());
      forwardButton.setDisable(true);
      backButton.setDisable(false);
    }
    return entryList.get(currentIndex).getUrl();
  }
コード例 #26
0
ファイル: Box_Guide.java プロジェクト: YeMyintOo/UML
  public Box_Guide(Stage owner) {
    super();
    initOwner(owner);
    webView = new WebView();
    webEngine = webView.getEngine();
    BorderPane pane = new BorderPane();

    String html =
        "<html><head><title>Test</title></head>"
            + "<body><h1>Help Guide using WebView</h1></body></html>";

    webEngine.loadContent(html);
    pane.setCenter(webView);
    Scene scene = new Scene(pane);
    setScene(scene);
    setTitle("User Guide");
  }
コード例 #27
0
 @Override
 public void start(Stage primaryStage) {
   WebView webView = new WebView();
   final WebEngine engine = webView.getEngine();
   engine.load(WebViewCharts.class.getResource("charts.html").toExternalForm());
   Scene scene = new Scene(webView, 300, 250);
   engine
       .getLoadWorker()
       .stateProperty()
       .addListener(
           (e, o, n) -> {
             if (n == State.SUCCEEDED) {
               String js =
                   constructJavaScript(
                       "Beispiel-Tabelle",
                       new String[] {
                         "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
                         "Nov", "Dec"
                       },
                       "Temperature",
                       new Series(
                           "Tokyo",
                           new float[] {
                             7.0f, 6.9f, 9.5f, 14.5f, 18.2f, 21.5f, 25.2f, 26.5f, 23.3f, 18.3f,
                             13.9f, 9.6f
                           }),
                       new Series(
                           "Munich",
                           new float[] {
                             -0.2f, 0.8f, 5.7f, 11.3f, 17.0f, 22.0f, 24.8f, 24.1f, 20.1f, 14.1f,
                             8.6f, 2.5f
                           }),
                       new Series(
                           "London",
                           new float[] {
                             3.9f, 4.2f, 5.7f, 8.5f, 11.9f, 15.2f, 17.0f, 16.6f, 14.2f, 10.3f,
                             6.6f, 4.8f
                           }));
               engine.executeScript(js);
             }
           });
   primaryStage.setTitle("JavaFX WebView Chart Demo");
   primaryStage.setScene(scene);
   primaryStage.show();
 }
コード例 #28
0
  public static void showWebBrowser(String title, String url) {
    final Stage dialog = new Stage();
    dialog.setTitle(title);

    WebView browser = new WebView();
    WebEngine engine = browser.getEngine();
    engine.load(url);

    Scene dialogScene = new Scene(browser);
    dialogScene.getStylesheets().add(ResourceManager.getUIThemeStyle());
    dialog.setScene(dialogScene);

    dialog.setMinHeight(700);
    dialog.setMinWidth(1050);

    dialog.show();
    dialog.requestFocus();
  }
コード例 #29
0
ファイル: Browser.java プロジェクト: gamerkhang/INFX141-Asst3
  @Override
  public void start(Stage stage) {

    indexer = new Indexer();
    indexer.read("index.ser");

    window = stage;
    window.setTitle("Browser");

    // Layout
    BorderPane border = new BorderPane();
    HBox hBox = new HBox(10);
    hBox.setPadding(new Insets(20, 20, 20, 20));
    border.setTop(hBox);

    VBox vBox = new VBox(10);
    vBox.setPadding(new Insets(20, 20, 20, 20));
    border.setCenter(vBox);

    // Search Bar / Button
    searchTextField = new TextField();
    searchButton = new Button("Search");
    searchTextField.setPrefWidth(1000);
    searchButton.setOnAction(event -> search());
    label = new Label("Status: ");
    label.setPadding(new Insets(20, 20, 20, 20));
    border.setBottom(label);

    // WebView
    webView = new WebView();
    webEngine = webView.getEngine();
    webView.isVisible();

    vBox.getChildren().addAll(webView);
    hBox.getChildren().addAll(searchTextField, searchButton);
    scene = new Scene(border, 1200, 600);
    window.setScene(scene);
    stage.setResizable(false);
    window.show();

    System.out.println(searchTextField.getText());
  }
コード例 #30
0
 @FXML
 private void HandleValidateButtonAction(ActionEvent event) {
   String s = StringEscapeUtils.unescapeHtml(markdownToHtml(SourceText.getText()));
   if (corrector == null) {
     corrector = new Corrector();
   }
   try {
     String result = corrector.checkHtmlContent(s);
     WebEngine webEngine = renderView.getEngine();
     webEngine.loadContent(
         "<!doctype html><html lang='fr'><head><meta charset='utf-8'><base href='file://"
             + MainApp.class.getResource(".").getPath()
             + "' /></head><body>"
             + result
             + "</body></html>");
     webEngine.setUserStyleSheetLocation(
         MainApp.class.getResource("css/content.css").toExternalForm());
   } catch (DOMException e) {
     logger.error(e.getMessage(), e);
   }
 }