Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.IOException;

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

public class Main extends JFrame {

    public static void main(String args[]) {
        Main e = new Main();
        e.setVisible(true);
    }

    public Main() {

        JEditorPane web = new JEditorPane();
        web.setEditable(false);

        try {
            web.setPage("http://www.cnn.com");
        } catch (IOException e) {
            web.setContentType("text/html");
            web.setText("<html>Could not load</html>");
        }

        final JScrollPane scrollPane = new JScrollPane(web);
        getContentPane().add(scrollPane);
        this.setBounds(0, 0, 200, 200);

    }

}