Example usage for javax.swing JEditorPane JEditorPane

List of usage examples for javax.swing JEditorPane JEditorPane

Introduction

In this page you can find the example usage for javax.swing JEditorPane JEditorPane.

Prototype

public JEditorPane(String url) throws IOException 

Source Link

Document

Creates a JEditorPane based on a string containing a URL specification.

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    String url = "http://www.yahoo.com";
    JEditorPane editor = new JEditorPane(url);
    editor.setEditable(false);//from   ww w.  j av a  2  s . c om
    JScrollPane pane = new JScrollPane(editor);
    JFrame f = new JFrame("HTML Demo");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(pane);
    f.setSize(800, 600);
    f.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    File f = new File("index.html");
    JEditorPane jep = new JEditorPane(f.toURI().toURL());

    JScrollPane sp = new JScrollPane(jep);
    sp.setPreferredSize(new Dimension(400, 200));

    JOptionPane.showMessageDialog(null, sp);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {

    String url = "http://java.sun.com";
    JEditorPane editorPane = new JEditorPane(url);
    editorPane.setEditable(false);/*ww  w .  j  a  v a  2s  .co m*/
    editorPane.addHyperlinkListener(new MyHyperlinkListener());
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {//from ww  w .  j  a  v  a2 s . c o  m
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        String b = editorPane.getText();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {/*  ww w  .  ja v a 2 s .  co m*/
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        URL url = editorPane.getPage();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {/*from   w  w  w .  j  a  v  a  2  s  .com*/
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        boolean b = editorPane.getScrollableTracksViewportWidth();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {/*from ww w .  j ava 2  s  .com*/
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        boolean b = editorPane.getScrollableTracksViewportHeight();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {/*from w  w w.j  a  v a 2s.c om*/
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        Dimension dimension = editorPane.getPreferredSize();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {//from ww  w  . ja v  a  2 s.  c om
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        EditorKit kit = editorPane.getEditorKit();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}

From source file:Main.java

public static void main(final String args[]) {
    JFrame frame = new JFrame("EditorPane Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    try {//  w  w  w  . j av a  2s. c  o  m
        JEditorPane editorPane = new JEditorPane("http://www.java2s.com");
        editorPane.setEditable(false);
        String type = editorPane.getContentType();

        JScrollPane scrollPane = new JScrollPane(editorPane);
        frame.add(scrollPane);
    } catch (IOException e) {
        System.err.println("Unable to load: " + e);
    }

    frame.setSize(640, 480);
    frame.setVisible(true);
}