Can I have different foreground colors in one text area? Different fonts?
I want to add something like "hh:mm:ss Nickname: message", with time being gray, name - blue, message - black.
Can I have different foreground colors in one text area? Different fonts?
I want to add something like "hh:mm:ss Nickname: message", with time being gray, name - blue, message - black.
I made a mistake in my comment: it is JTextPane what you want, not JTextArea.
It turns out that seesaw supports JTextPane. See (seesaw.core/styled-text)
, which creates JTextPane
s, and (seesaw.core/style-text!)
which applies different styles to the text inside the pane.
Their usage seems to be pretty straightforward: first you define mapping id -> style
during pane construction, and then you use this id
when you assign styles to parts of the text.
Textarea is a standard HTML element and it cannot take more styles. One way to acheive this is to use an iFrame and style the contents inside the iFrame. Otherway to achieve without iFrame is choose an editor that supports this features. One such editor is WMD which is used in stackoverflow. WMD files are here