////////////////////CODE
import javax.swing.*;
import javax.swing.text.*;
import java.awt.*;
import java.io.*;
public class TJEditorPane extends JFrame
{
public TJEditorPane()
{
super( "Test Editor Pane" );
Container container = this.getContentPane();
JEditorPane editorPane;
File file = new File( "c:\\sms.ini" );
try
{
if( file.exists() )
{
System.out.println( "File: " + file.getPath() );
System.out.println( "URL: " + file.toURL() );
editorPane = new JEditorPane( file.toURL() );
container.add( editorPane );
//editorPane.setPage( file.toURL() );
//FileInputStream stream = new FileInputStream( file );
//editorPane.read( stream, "Test Stream" );
}
}
catch( Exception e )
{
System.out.println( "Exception: " + e );
}
show();
}
public static void main( String[] args )
{
new TJEditorPane();
}
}
/////////////OUTPUT
File: c:\sms.ini
URL: file:/c:/sms.ini
java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:124)
at
javax.swing.JEditorPane.createEditorKitForContentType(JEditorPane.java:849)
at
javax.swing.JEditorPane.getEditorKitForContentType(JEditorPane.java:741)
at javax.swing.JEditorPane.setContentType(JEditorPane.java:645)
at javax.swing.JEditorPane.getStream(JEditorPane.java:483)
at javax.swing.JEditorPane.setPage(JEditorPane.java:309)
at javax.swing.JEditorPane.<init>(JEditorPane.java:174)
at TJEditorPane.<init>(TJEditorPane.java:24)
at TJEditorPane.main(TJEditorPane.java:41)
The file exists and I do have read permission on it. Any help in figuring
out what is wrong would be great!!
Thanks
Chris
Chris Williams <will...@mail.northgrum.com> wrote in article
<01beade9$1d357360$8168e484@pc3535>...