The simplest java browser and the simplest java Browser
/*** Created by Admin on login /3/27. */import java. awt. borderLayout; import java. awt. container; import java. awt. event. actionEvent; import java. awt. event. actionListener; import java.net. URL; import javax. swing. JButton; import javax. swing. JFrame; import javax. swing. JLabel; import javax. swing. JPanel; import javax. swing. JScrollPane; import javax. swing. JTextField; import javax. swing. JTextPane; public class HttpBrow SerDemo extends JFrame {JTextField jtfAddress; JButton jbGo; JTextPane jtpShow; JLabel jlInfo; public HttpBrowserDemo () {super ("html"); jtfAddress = new JTextField (20 ); jbGo = new JButton ("go to"); jtpShow = new JTextPane (); jlInfo = new JLabel (); JPanel panel = new JPanel (); panel. add (new JLabel ("Address"); panel. add (jtfAddress); panel. add (jbGo); JScrollPane jsp = new JScrollPane (jtpShow); Container container = get ContentPane (); container. add (panel, BorderLayout. NORTH); container. add (jsp, BorderLayout. CENTER); container. add (jlInfo, BorderLayout. SOUTH); jbGo. addActionListener (new ShowHTMLListener (); jtfAddress. addActionListener (new ShowHTMLListener (); setSize (350,280); setVisible (true); setdefaclocloseoperation (JFrame. EXIT_ON_CLOSE);} class ShowHTMLListener implements ActionListener {@ Override public void ac Tionreceivmed (ActionEvent e) {// TODO Auto-generated method stub try {jlInfo. setText ("linking... "); URL address = new URL (jtfAddress. getText (); jtpShow. setPage (address); jlInfo. setText ("finished");} catch (Exception ex) {jlInfo. setText ("Link error, please enter the correct URL address! "); Ex. printStackTrace () ;}} public static void main (String [] args) {new HttpBrowserDemo ();}}