javalover520 / jsyntaxpane

Automatically exported from code.google.com/p/jsyntaxpane
0 stars 0 forks source link

IllegalArgumentException "Must be StyledEditorKit", when using a JTextPane #110

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. DefaultSyntaxKit.initKit();
2. JTextPane pane = new JTextPane();
3. pane.setContentType("text/python");

What is the expected output? What do you see instead?
As JTextPane is a subclass of JEditorPane I suggest that jsyntaxpane also works 
on JTextPane.

What version of the product are you using? On what operating system?
Version 0.9.4 on a Mac OS X 10.6 (Snow Leopard)

Please provide any additional information below.

Exception in thread "main" java.lang.IllegalArgumentException: Must be 
StyledEditorKit
    at javax.swing.JTextPane.setEditorKit(JTextPane.java:488)
    at javax.swing.JEditorPane.setContentType(JEditorPane.java:1021)
    at 
de.unifrankfurt.cs.gdv.jydle.editors.python.PythonConsole.initComponents(PythonC
onsole.java:1
51)
    at de.unifrankfurt.cs.gdv.jydle.editors.python.PythonConsole.<init>(PythonConsole.java:72)
    at de.unifrankfurt.cs.gdv.jydle.components.jyDLEPanel.init(jyDLEPanel.java:178)
    at de.unifrankfurt.cs.gdv.jydle.components.jyDLEPanel.<init>(jyDLEPanel.java:59)
    at de.unifrankfurt.cs.gdv.jydle.jyDLE.main(jyDLE.java:102)

Original issue reported on code.google.com by stefan.b...@googlemail.com on 16 Sep 2009 at 11:49

GoogleCodeExporter commented 8 years ago
I did have an issue when using the JTextPane.  The way a TextPane handles and 
creats
its documents made it almost unusable.  A JTextPane can be used to embed other 
text
and graphics, so it has much more features than JEditorPane.

I'll see if I can pinpoint the cause, and maybe work out a solution.

Any reason why you need a TextPane instead of EditorPane?

Original comment by ayman.al...@gmail.com on 23 Sep 2009 at 8:18

GoogleCodeExporter commented 8 years ago
As you have mentioned JTextPane comes along with more support for additional 
styles. I am actually in 
writing a Java version of the Python IDLE and besides the syntax highlighting 
for the Python code I was 
thinking about how to highlight the rest of the console stuff. It would be 
easier to having a JTextPane and 
adding some additional styles for lets say a simple line of a console output. I 
didnt see a way how to do this 
with jsyntaxpane and it might not be done for this, I must admit, but I love 
this. :-)

I came up with a new lexer which I called PythonConsoleLexer and prototyped it 
in the 0.95 release (JDK5). 
Works fine as far as I have tested. I helped myself with putting hidden chars 
on the start of a new line to mark 
it as e.g. an error message. Python code is interpretated after the starting 
>>> or ..., typically for Python's 
IDLE. This was the main reason why I thought about having this. To get you to 
have a better feeling about 
this, have a look at the screenshots. But from the current effort I could make 
with jsyntaxpane I would say it 
is not necessary to have a support for the JTextPane. I understand why it would 
be hard and it is worth the 
time you would have to spent for implemenation.

Thanks, issue might be closed.

Original comment by stefan.b...@googlemail.com on 23 Sep 2009 at 5:32

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by ayman.al...@gmail.com on 7 Jul 2010 at 1:32