Results 1 to 2 of 2
Thread: set jEditorPane css problem
- 04-15-2011, 04:33 AM #1
Member
- Join Date
- Feb 2011
- Posts
- 64
- Rep Power
- 0
set jEditorPane css problem
hello,
I'm trying to change the font color of text in a jEditorPane in a desktop application. bellow is the code i'm using:
the following is the error that I get:Java Code:try{ System.out.print("test"); jEditorPane1.setContentType("text/html"); HTMLEditorKit kit = new HTMLEditorKit(); jEditorPane1.setEditorKit(kit); StyleSheet styleSheet = kit.getStyleSheet(); styleSheet.addRule("<style type=\"text/css\"> p { color:red;}</style>"); } catch (Exception e){ jEditorPane1.setText(e.toString()); }
Exception in thread "Thread-4" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(Abs tractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStr ingBuilder.java:515)
at java.lang.StringBuffer.append(StringBuffer.java:30 6)
at java.io.StringWriter.write(StringWriter.java:77)
at javax.swing.text.AbstractWriter.output(AbstractWri ter.java:679)
at javax.swing.text.html.HTMLWriter.output(HTMLWriter .java:1172)
at javax.swing.text.AbstractWriter.write(AbstractWrit er.java:547)
at javax.swing.text.AbstractWriter.write(AbstractWrit er.java:497)
at javax.swing.text.html.HTMLWriter.writeComment(HTML Writer.java:626)
at javax.swing.text.html.HTMLWriter.writeAdditionalCo mments(HTMLWriter.java:646)
at javax.swing.text.html.HTMLWriter.write(HTMLWriter. java:217)
at javax.swing.text.html.HTMLEditorKit.write(HTMLEdit orKit.java:292)
at javax.swing.text.JTextComponent.write(JTextCompone nt.java:1616)
at javax.swing.JEditorPane.getText(JEditorPane.java:1 522)
at webagent.WebAgentView.AppendJText(WebAgentView.jav a:518)
at webagent.ReadURL.run(ReadURL.java:57)
at java.lang.Thread.run(Thread.java:662)
can anyone tell me what I'm doing wrong?
Thanks
jason
- 04-15-2011, 08:35 PM #2
Member
- Join Date
- Feb 2011
- Posts
- 64
- Rep Power
- 0
Anyone?
Anyone have any suggestions or am i just going about this the wrong way? I want to have a some form of textfield where i can change the font color (for instance, make every other line red). if not with the jEditorPane, some other object i could use, and a working example would be great.
thanks
jason
Similar Threads
-
Get Row/Column In JEditorPane
By 67726e in forum AWT / SwingReplies: 3Last Post: 11-08-2010, 01:10 AM -
JEditorPane + MouseWheel
By Moncleared in forum New To JavaReplies: 2Last Post: 10-09-2010, 01:27 AM -
Problem with writting in JEditorPane.
By marox in forum AWT / SwingReplies: 11Last Post: 04-20-2010, 11:25 PM -
JEditorPane Example
By Java Tip in forum javax.swingReplies: 0Last Post: 06-27-2008, 07:47 PM -
JEditorPane
By drmmr11 in forum Java AppletsReplies: 0Last Post: 08-02-2007, 06:08 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks