Reputation: 1
i want to display a text in a jtextPane but on each time i want it to be with a different color without changing the previous text color if that possible Any help will be appreciated thank's in advance
Upvotes: 0
Views: 31
Reputation: 6115
You can use StyledEditorKit.ForegroundAction, but also StyledDocument.setCharacterAttributes , or edit the inputAttributes from StyledDocument.getInputAttributes. You can use StyleConstants.setForeground to edit a MuttableAttributeSet like a SimpleAttributeSet for instance.
Upvotes: 1