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());

~

~

[1833 byte] By [kaprasannaa] at [2007-11-27 5:45:56]
# 1

Post a executable demo with a sample string of html text.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

Don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the posted code retains its original formatting.

camickra at 2007-7-12 15:28:06 > top of Java-index,Desktop,Core GUI APIs...