GMgKe586q6suSQnyqZLlGCooeWM

Pages

Search

Wednesday, December 22, 2010

Swing JEditorPane

This component can be made to load a text string or other. For file you can use: file:\\d:\\data.txt

import javax.swing.*:

public class Main{

    public static void main(String[] args){

        JFrame frame = new JFrame("JEditorPane Application");

        JEditorPane editPane = new JEditorPane();

        try{
            editPane.setPage("http://google.com");
        }catch(Exception ex){
            ex.printStackTrace();
        }

        frame.add(editPane);
        frame.setSize(400, 300);
        frame.setLocation(200, 100);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
   }
}
Share/Bookmark

No comments:

Post a Comment