public void openURL(String url) { try { editorPane.setPage(url); } catch (Exception e) { e.printStackTrace(); displayError("Error Loading URL " + url, "Message: " + e.toString()); return; } loadedFile = null; redraw(); }
private void openURL(String url) { try { editorPane.setPage(url); } catch (Exception e) { log.info("Error loading |" + url + '|');
JEditorPane jep = new JEditorPane(); jep.setEditable(false); try { jep.setPage("http://www.yoursite.com"); }catch (IOException e) { jep.setContentType("text/html"); jep.setText("<html>Could not load</html>"); } JScrollPane scrollPane = new JScrollPane(jep); JFrame f = new JFrame("Test HTML"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(scrollPane); f.setPreferredSize(new Dimension(800,600)); f.setVisible(true);
@Override public void run() { // Load the current page try { editorPane.setPage(currentPage()); } catch (IOException e) { log.warn("Unable to load current page ", e); } } });
private void GoToUrl(String url) { try { htmlPane_.setPage(url); } catch (IOException e) { e.printStackTrace(System.err); } } private JEditorPane htmlPane_ = null;
JEditorPane editorPane_WEB = new JEditorPane(); editorPane_WEB.setEditable(false); //OPTIONAL editorPane_WEB.setBorder(null); //OPTIONAL try { editorPane_WEB.setPage("http://---------------.com/--.html"); //Or Path/File destination } catch (IOException error) {/*ERROR*/} JScrollPane scrollPane_WEB = new JScrollPane(editorPane_WEB); scrollPane_WEB.setBounds(67, 27, 798, 465); // Don't use null layout. scrollPane_WEB.getVerticalScrollBar().setUnitIncrement(10); add(scrollPane_WEB); //class extends JFrame/JPanel
public static void loadTextFileIntoEditorPane(String filePath, JEditorPane editor) throws IOException { File file = new File(filePath); editor.setPage(file.toURI().toURL()); }
private static void loadHtml(JEditorPane htmlc, JTextField url, String link) { try{ htmlc.setPage(link); url.setText(link); }catch(Exception e){ System.out.println("ops sorry could not find Virgin Mobile"); e.printStackTrace(); } }
JEditorPane document = new JEditorPane(); File file = fileChooser.getSelectedFile(); try { document.setPage(file.toURI().toURL()); } catch(Exception e) { e.printStackTrace(); }
@Override public void actionPerformed(ActionEvent e) { URL previous = m_browserHistory.removeLast(); try { m_infoPane.setPage(previous); if (m_browserHistory.size() == 0) { m_backB.setEnabled(false); } } catch (IOException ex) { // } } });
private static final JTextField url = new JTextField(20); private static final JEditorPane htmlc = new JEditorPane(); private static void loadHtml(String link) { try{ htmlc.setPage(link); url.setText(link); }catch(Exception e){ System.out.println("ops sorry could not find Virgin Mobile"); e.printStackTrace(); } }
HttpURLConnection conn = (HttpURLConnection)url.openConnection(); for(int i=0; i<20; i++ ) { long starTime = System.currentTimeMillis(); conn.connect(); JEditorPane editorPane = new JEditorPane(); editorPane.setPage(new URL()); long elasedTime = System.currentTimeMillis() - starTime; System.out.println(elasedTime); conn.disconnect(); }
protected void loadURL() throws IOException { try { HistoryEntry he = (HistoryEntry) history.get(historyIndex); htmlPane.setPage(he.url); } finally { updateButtons(); } }
private void initContent() { try { contentPane.setPage(HttpUtils.createURL("http://www.broadinstitute.org/igv/projects/los.html")); } catch (Exception e) { e.printStackTrace(); } }
public void hyperlinkUpdate(HyperlinkEvent e) { try { if (HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) { mainView.setPage(e.getURL()); } } catch (Exception ex) { handleError("hyperlinkUpdate(HyperlinkEvent)", ex, false); } } });
public void hyperlinkUpdate(HyperlinkEvent e) { if(e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) return; try { editor.setPage(e.getURL()); } catch(IOException ex) { System.err.println(ex.toString()); } } }
public static void main(String[] args) throws PrintException, IOException, PrinterException { JEditorPane editorPane = new JEditorPane(); editorPane.setEditable(false); URL urlToPage = new File("/home/me/Temp/page.html").toURI().toURL(); editorPane.setPage(urlToPage); editorPane.print(null, null, false, PrintServiceLookup.lookupDefaultPrintService(), null, false); }
try { URL url = this.getClass().getResource("/license-uk.html"); JEditorPane html = new JEditorPane(); html.setPage(url); html.setEditable( false ); JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add(html); topPanel.add( scrollPane, BorderLayout.CENTER ); html.addHyperlinkListener( this ); }
JEditorPane eulaEP = new JEditorPane(); eulaEP.addPropertyChangeListener("page", e -> { HTMLDocument htm = (HTMLDocument) eulaEP.getDocument(); Element el = htm.getElement("unique_id"); // ... }); try { eulaEP.setPage(url); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
public void createCreditsPanel() { JEditorPane editor = (JEditorPane) m_view.getComponentByName(AboutViewNames.ID_CREDITS); editor.setEditorKit(new javax.swing.text.html.HTMLEditorKit()); try { java.net.URL url = AboutView.class.getClassLoader().getResource("com/jeta/swingbuilder/resources/help/credits.htm"); editor.setPage(url); editor.setEditable(false); } catch (Exception e) { e.printStackTrace(); } }