public static void main(String[] args) { final Browser browser = new Browser(); BrowserView browserView = new BrowserView(browser); final JTextField addressBar = new JTextField("http://www.teamdev.com/jxbrowser"); addressBar.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { browser.loadURL(addressBar.getText()); } }); JPanel addressPane = new JPanel(new BorderLayout()); addressPane.add(new JLabel(" URL: "), BorderLayout.WEST); addressPane.add(addressBar, BorderLayout.CENTER); JFrame frame = new JFrame("JxBrowser - Hello World"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(addressPane, BorderLayout.NORTH); frame.add(browserView, BorderLayout.CENTER); frame.setSize(800, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.loadURL(addressBar.getText()); }
public static void main(String[] args) { Browser browser = new Browser(); BrowserView browserView = new BrowserView(browser); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(browserView, BorderLayout.CENTER); frame.setSize(800, 600); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.setDownloadHandler( new DownloadHandler() { public boolean allowDownload(DownloadItem download) { download.addDownloadListener( new DownloadListener() { public void onDownloadUpdated(DownloadEvent event) { DownloadItem download = event.getDownloadItem(); if (download.isCompleted()) { System.out.println("Download is completed!"); } } }); System.out.println( "Destination file: " + download.getDestinationFile().getAbsolutePath()); return true; } }); browser.loadURL("ftp://ftp.teamdev.com/updates/jxbrowser-4.0-beta.zip"); }
public void googleMaps() { this.setTitle("Geolocalización Salas y Departamentos"); // titulo browser = new Browser(); // onjeto para que te cren las paginas en tu jframe browser.loadURL( "C:\\Users\\Usuario\\Documents\\NetBeansProjects\\Proyecto Geolocalizacion\\src\\Intefaz\\mapas.html"); view = new BrowserView(browser); // objeto para ver la pagina web en java this.panelMapa.add(view); // agregar la pagina al jframe this.setLocationRelativeTo(null); // centrar la pantalla this.setVisible(true); // hacer visible }
public static void main(String[] args) { JxBrowserDemo d = new JxBrowserDemo(); Browser browser = d.getBrowser(); BrowserView view = new BrowserView(browser); JFrame frame = new JFrame(); frame.add(view, BorderLayout.CENTER); frame.setSize(700, 500); frame.setVisible(true); browser.loadURL("http://www.google.com"); }
public static void main(String[] args) { Browser browser = new Browser(); BrowserView browserView = new BrowserView(browser); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(browserView, BorderLayout.CENTER); frame.setSize(700, 500); frame.setLocationRelativeTo(null); frame.setVisible(true); browser.setContextMenuHandler(new MyContextMenuHandler(browserView)); browser.loadURL("http://www.google.com"); }
@Override public void start(Stage primaryStage) throws Exception { BorderPane pane = FXMLLoader.load(FXMLSample.class.getResource("sample.fxml")); BorderPane browserPane = (BorderPane) pane.getCenter(); final Browser browser = new Browser(); browserPane.setCenter(new BrowserView(browser)); final TextField textField = (TextField) pane.getTop(); textField.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { browser.loadURL(textField.getText()); } }); primaryStage.setTitle("FXMLSample"); primaryStage.setScene(new Scene(pane, 800, 600)); primaryStage.show(); browser.loadURL(textField.getText()); }
public static void initComponents() { final Browser browser = new Browser(); JFrame parent = new JFrame(); final JDialog dialog = new JDialog(parent, "QUIZ", true); browser.loadURL("http://dtprojecten.ehb.be/~PR-Ready/StatMenuWindow.html?85519519551951951"); dialog.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); } }); browser.registerFunction( "createPieChart", new BrowserFunction() { public JSValue invoke(JSValue... jsValues) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); PieChartData[] dataArr = new PieChartData[6]; dataArr[0] = new PieChartData("De grote quiz", 50); dataArr[1] = new PieChartData("Test uw IQ!", 1); dataArr[2] = new PieChartData("Gestolen rijexamens", 15); dataArr[3] = new PieChartData("Win een reis!", 4); dataArr[4] = new PieChartData("Test uw kennis!", 10); dataArr[5] = new PieChartData("Kan u de verschillen aanwijzen?", 20); new PieChartWindow(factory, dataArr, "Populariteit per quiz"); return JSValue.createUndefined(); } }); browser.registerFunction( "createLineChart", new BrowserFunction() { public JSValue invoke(JSValue... jsValues) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); LineChartData[] lineData = new LineChartData[3]; String title = "User creation"; String subtitle = "By month"; String leftTitle = "Users"; String[] categories = new String[3]; categories[0] = "September"; categories[1] = "Oktober"; categories[2] = "November"; double[] data = new double[3]; data[0] = 10; data[1] = 2; data[2] = 50; lineData[0] = new LineChartData("September", data); lineData[1] = new LineChartData("Oktober", data); lineData[2] = new LineChartData("November", data); new LineChartWindow(factory, lineData, title, subtitle, leftTitle, categories); return JSValue.createUndefined(); } }); browser.registerFunction( "createColumnChart", new BrowserFunction() { public JSValue invoke(JSValue... jsValues) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); ColumnData[] dataColumn = new ColumnData[1]; double[] data = new double[3]; data[0] = 33.6; data[1] = 88; data[2] = 66; String title = "Gemiddelde score per quiz"; String subtitle = ""; dataColumn[0] = new ColumnData("Gemiddelde Score", data); new ColumnChartWindow(factory, dataColumn, title, subtitle); return JSValue.createUndefined(); } }); browser.registerFunction( "onExit", new BrowserFunction() { public JSValue invoke(JSValue... jsValues) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); System.out.println("exit"); try { AdminMenuWindow amw = new AdminMenuWindow(factory); } catch (UserNoPermissionException e) { e.printStackTrace(); } return JSValue.createUndefined(); } }); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.add(new BrowserView(browser), BorderLayout.CENTER); dialog.setResizable(false); dialog.setUndecorated(true); dialog.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); }
public void initComponents() { final Browser browser = new Browser(); BrowserView browserView = new BrowserView(browser); JFrame parent = new JFrame(); final JDialog dialog = new JDialog(parent, "QUIZ", true); browser.addLoadListener( new LoadAdapter() { @Override public void onFinishLoadingFrame(FinishLoadingEvent event) { if (event.isMainFrame()) { String videoUrl = "https://www.youtube.com/embed/" + url + "?rel=0&controls=0&showinfo=0"; DOMDocument document = event.getBrowser().getDocument(); DOMNode root = document.findElement(By.id("video")); DOMElement iframe = document.createElement("iframe"); iframe.setAttribute("src", videoUrl); iframe.setAttribute("frameborder", "0"); root.appendChild(iframe); DOMNode root2 = document.findElement(By.id("text")); DOMElement p = document.createElement("p"); p.setAttribute("class", "text"); DOMNode n = document.createTextNode(question.getText()); root2.appendChild(p); p.appendChild(n); DOMNode answers = document.findElement(By.id("answers")); if (question.getAnswerType().equals(AnswerType.MULTIPLE_CHOICE)) { DOMNode form = document.createElement("form"); AnswerManager am = new AnswerManager(session); List<String> answerList = am.getAnswerByQuestionId(question.getId()); for (String answer : answerList) { DOMElement trueBox = document.createElement("input"); trueBox.setAttribute("type", "radio"); trueBox.setAttribute("name", "tf"); DOMNode dataTrue = document.createTextNode(answer); DOMElement labeltrue = document.createElement("label"); labeltrue.appendChild(dataTrue); form.appendChild(trueBox); form.appendChild(labeltrue); DOMElement br = document.createElement("br"); form.appendChild(br); } answers.appendChild(form); } if (question.getAnswerType().equals(AnswerType.TRUE_FALSE)) { DOMNode form = document.createElement("form"); DOMElement trueBox = document.createElement("input"); trueBox.setAttribute("type", "radio"); trueBox.setAttribute("name", "tf"); DOMNode dataTrue = document.createTextNode("true"); DOMElement labeltrue = document.createElement("label"); labeltrue.appendChild(dataTrue); DOMElement falseBox = document.createElement("input"); DOMNode dataFalse = document.createTextNode("false"); DOMElement labelFalse = document.createElement("label"); labelFalse.appendChild(dataFalse); falseBox.setAttribute("type", "radio"); falseBox.setAttribute("name", "tf"); form.appendChild(labeltrue); form.appendChild(trueBox); DOMElement br = document.createElement("br"); form.appendChild(br); form.appendChild(labelFalse); form.appendChild(falseBox); // answers.appendChild(form); } } } }); browser.loadURL("http://dtprojecten.ehb.be/~PR-Ready/question/videoFrame.html?853954951951959"); dialog.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); } }); browser.registerFunction( "nextQuestion", new BrowserFunction() { public JSValue invoke(JSValue... jsValues) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); quizLauncher.setIncrement(quizLauncher.getIncrement() + 1); quizLauncher.windowChoice(); return JSValue.createUndefined(); } }); browser.registerFunction( "previousQuestion", new BrowserFunction() { public JSValue invoke(JSValue... jsValues) { browser.dispose(); dialog.setVisible(false); dialog.dispose(); quizLauncher.setIncrement(quizLauncher.getIncrement() - 1); quizLauncher.windowChoice(); return JSValue.createUndefined(); } }); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.add(new BrowserView(browser), BorderLayout.CENTER); dialog.setResizable(false); dialog.setUndecorated(true); dialog.setBounds(GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); }