本文整理了Java中javax.swing.JEditorPane.setPage()
方法的一些代码示例,展示了JEditorPane.setPage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JEditorPane.setPage()
方法的具体详情如下:
包路径:javax.swing.JEditorPane
类名称:JEditorPane
方法名:setPage
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
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();
}
代码示例来源:origin: stanfordnlp/CoreNLP
private void openURL(String url) {
try {
editorPane.setPage(url);
} catch (Exception e) {
log.info("Error loading |" + url + '|');
代码示例来源:origin: stackoverflow.com
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);
代码示例来源:origin: Multibit-Legacy/multibit-hd
@Override
public void run() {
// Load the current page
try {
editorPane.setPage(currentPage());
} catch (IOException e) {
log.warn("Unable to load current page ", e);
}
}
});
代码示例来源:origin: gov.nih.nlm.nls.lvg/lvg2010dist
private void GoToUrl(String url)
{
try
{
htmlPane_.setPage(url);
}
catch (IOException e)
{
e.printStackTrace(System.err);
}
}
private JEditorPane htmlPane_ = null;
代码示例来源:origin: stackoverflow.com
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
代码示例来源:origin: stackoverflow.com
public static void loadTextFileIntoEditorPane(String filePath, JEditorPane editor) throws IOException
{
File file = new File(filePath);
editor.setPage(file.toURI().toURL());
}
代码示例来源:origin: stackoverflow.com
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();
}
}
代码示例来源:origin: stackoverflow.com
JEditorPane document = new JEditorPane();
File file = fileChooser.getSelectedFile();
try {
document.setPage(file.toURI().toURL());
} catch(Exception e) {
e.printStackTrace();
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
@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) {
//
}
}
});
代码示例来源:origin: stackoverflow.com
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();
}
}
代码示例来源:origin: stackoverflow.com
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();
}
代码示例来源:origin: de.sciss/scisslib
protected void loadURL()
throws IOException {
try {
HistoryEntry he = (HistoryEntry) history.get(historyIndex);
htmlPane.setPage(he.url);
} finally {
updateButtons();
}
}
代码示例来源:origin: igvteam/igv
private void initContent() {
try {
contentPane.setPage(HttpUtils.createURL("http://www.broadinstitute.org/igv/projects/los.html"));
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: MegaMek/megamek
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);
}
}
});
代码示例来源:origin: net.sf.tinylaf/tinylaf
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());
}
}
}
代码示例来源:origin: stackoverflow.com
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);
}
代码示例来源:origin: stackoverflow.com
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 );
}
代码示例来源:origin: stackoverflow.com
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();
}
代码示例来源:origin: net.java.abeille/abeille
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();
}
}
内容来源于网络,如有侵权,请联系作者删除!