JEditor doesnt show html document
Hi,
I am passing String to the JEditor and it is not showing up as an html page
The screep appears blank with a small bip sound!
What could have gone wrong?
Here is the code...
import java.awt.BorderLayout;
import java.awt.Container;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import java.io.*;
publicclass EditorDisplay{
publicstaticvoid display(String file)throws IOException{
JFrame f =new JFrame("JEditorPane Sample");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = f.getContentPane();
JEditorPane editor =new JEditorPane();
editor.setContentType("text/html");
editor.setEditable(false);
editor.setText(file);
JScrollPane scrollPane =new JScrollPane(editor);
content.add(scrollPane, BorderLayout.CENTER);
f.setSize(300, 200);
f.setVisible(true);
}
}
~
//calling..
EditorDisplay.display(somebuffer.toString());
~
~

