Hi everyone,
I am doing a custom document in which i am always getting an error at the point when i want to use the java HTMLReader class. The compiler says something about an enclosing instance and i really have no idea what the compiler means.
Here is the code
This is exactly what the compiler saysCode:import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.awt.print.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.plaf.basic.*; import javax.swing.text.rtf.*; import javax.swing.text.html.*; import javax.swing.undo.*; import javax.print.attribute.standard.*; import javax.swing.text.html.HTMLDocument.HTMLReader; class CustomStyledDocument extends DefaultStyledDocument { public CustomStyledDocument(StyleContext styles) { super(styles); } public void test () { String html = "Test"; int pop = 0; int push = 0; HTMLEditorKit.Parser parser = getParser(); //The below three lines is where the error occurs HTMLDocument.HTMLReader reader = new HTMLDocument.HTMLReader (offset, pop - 1, push, null, false, true, wantsTrailingNewline); parser.parse(new StringReader(html), reader, true); reader.flush(); } }
I do not seem to know what the compiler means about my error on using the java HTMLReader class.Code:an enclosing instance that contains javax.swing.text.html.HTMLDocument.HTMLReader is required
I hope someone can help me with this error
Thank You
Yours Sincerely
Richard West


Reply With Quote


Bookmarks