package three.day.frame;
import java.awt.Color;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
public class JEditorPaneDemo01 {
/**
* @param args
*/
public static void main(String[] args) {
JFrame frame = new JFrame("JEditorPane的使用示例");
frame.setBounds(300, 200, 500, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
JScrollPane scrollPane = new JScrollPane(editorPane,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
frame.add(scrollPane);
try
{
editorPane.setPage("http://www.baidu.com");
}
catch(IOException ex)
{
ex.printStackTrace();
}
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}