By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,650 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,650 IT Pros & Developers. It's quick & easy.

java

P: 1
how to import a webpage into jframe window
Feb 3 '12 #1
Share this Question
Share on Google+
1 Reply


P: 7
Expand|Select|Wrap|Line Numbers
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. import java.net.*;
  5.  
  6. public class TestShowPage {
  7.  public static void main(String args[]) {  
  8.   JTextPane tp = new JTextPane();
  9.   JScrollPane js = new JScrollPane();
  10.   js.getViewport().add(tp);
  11.   JFrame jf = new JFrame();
  12.   jf.getContentPane().add(js);
  13.   jf.pack();
  14.   jf.setSize(400,500);
  15.   jf.setVisible(true); 
  16.  
  17.   try {
  18.     URL url = new URL("http://www.zetucu.ro");
  19.     tp.setPage(url);
  20.     } 
  21.   catch (Exception e) {
  22.     e.printStackTrace();
  23.     }
  24.   }
  25.  }
  26.  
Feb 3 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.