开发者

Is there a way to set every other line in a java text area to a different color?

I want to set every other line in a java text area to a second color, is there a way to do this?

example:

<red>1</red>   开发者_开发百科 
<blue>2</blue>
<red>3</red>    
<blue>4</blue>

the red and blue tags are just for example only.


Neither java.awt.TextArea nor javax.swing.JTextArea support text (or background) decorations. It is one font & one style.

As indicated by Chris, a JTextPane (or JEditorPane) is designed for 'styled text' documents. JEP for example, will handle RTF & (simple) HTML/CSS formatting.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜