I tried everything... I cant find a suitable JSomething to be able to add words to a pane that are different sizes and fonts.

I tried JTextAreas but they only allow plain text. JEditorPanes allow HTML but don't seem to let me append single words for some reason.

I'm also bound by the requirement of being able to look back at previous lines and fetch the text without formatting (html tags, etc) for extra processing.

Does anyone have any ideas cause I'm totally stumped....

Recommended Answers

All 4 Replies

able to add words to a pane that are different sizes and fonts.

Look at the JTextPane class.

requirement of being able to look back at previous lines and fetch the text without formatting

What are you going to do with the fetched text? Hold/process it as a String?

I was able to figure out a way to append html into a JEditorPane and to save lines (by storing the words into a temp string, without html tags and implementing a commit() function to add it to the linked list), but it appears that I can only go up to the font size +7. I need to be able to reach any font size.

<font size=8>text</font> shows the same as size=7

Anyone have any suggestions?

For some reason,

<span style="font-size:42px;>test</span>

gets converted to

<font size="42px">test</font>

by the HTMLEditorKit for the JEditorPane... the above line isnt even formatted correctly...... Epic fail.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.