java组件渲染html

来源:互联网 发布:物联网和云计算 编辑:程序博客网 时间:2024/06/10 02:05

JEditorPane渲染html

public class Test<span style="font-family: Arial, Helvetica, sans-serif;">JEditorPane</span> {   private static String url="http://www.baidu.com";  public static void test() throws Exception {    JEditorPane editorPane = new JEditorPane();    editorPane.setEditable(false);    editorPane.setSize(200, 400);    editorPane.setPage(url);    JScrollPane pane = new JScrollPane(editorPane);    JFrame frame = new JFrame("PRINT");    frame.setResizable(false);    frame.setLocation(500, 400);    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);    frame.setContentPane(pane);    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);    frame.setSize(200, 300);    frame.show(); }  public static void main(String[] args) {    try {      test();    } catch (Exception e) {    }  }}


0 0
原创粉丝点击