Displaying Simple HTML Files - Java Swing

Java examples for Swing:JEditorPane

Description

Displaying Simple HTML Files

Demo Code

import java.awt.BorderLayout;
import java.io.IOException;

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

public class Main {
  public static void m() {
    try {/*w w w .  j  a v  a2s .  c  o  m*/
      String url = "http://java.sun.com";
      JEditorPane editorPane = new JEditorPane(url);
      editorPane.setEditable(false);

      JFrame frame = new JFrame();
      frame.getContentPane().add(editorPane, BorderLayout.CENTER);
      frame.setSize(300, 300);
      frame.setVisible(true);
    } catch (IOException e) {
    }
  }
}

Related Tutorials