Color « JTextArea « Java Swing Q&A





1. How can I set partial text color in JTextArea?    stackoverflow.com

I want to set color for specific lines in the text area. What I've found so far, is the following

// Declarations
private final DefaultStyledDocument document;
private final MutableAttributeSet homeAttributeSet;
private final MutableAttributeSet awayAttributeSet;

// Usage ...

2. Is it possible to display different color text in textarea    coderanch.com

Hi Rose, Scott answer will just change all the text to some color. I believe that is not what you are asking for. You probably want to be able to have some blue text and some red text and maybe some green... I don't think you can do that with AWT components because they are drawn by the native operating system. ...

3. where can i find such textarea component which can display mixed different color text    coderanch.com

Hi. now i'm coding chat client applet.I want to display different color for different user's message.But for some reason,i can not use Swing package. And i know it's pretty difficult to code such component from scratch. So i want to know where i can find such component?? Thanks for your talent and kindness!!

4. Set color within Text Area    coderanch.com

5. multi-color in JTextArea?    coderanch.com

6. using colors in TextArea    coderanch.com

7. JTextArea - more than one color    coderanch.com

hi shiva kumar, have the same question. but the color set on to the text area once will be applicable for the entire text in the text area. i wanted to implement the text area as it appears in the Yahoo chat! where each user's messages typed are in different colour. (i.e., one colour for each user) thank you regards sudha ...

8. How to set color of text in Text Area    coderanch.com

Hi, I have made a program which has a JTextArea. Now I want to append text in different color in it. What i mean that if the first line is in black color than next will be in red color and next will be in blue color and so on... The problem is if I try to use setForeground it takes ...

9. JTextArea color    coderanch.com





11. Multi-color JTextAreas    coderanch.com

12. How to set different color for the different text in a JTextArea    coderanch.com

Thanks a lot... I tried using JTextPane with Styled Document, it works.. Now the problem is i have save the colored text alone in one format along with the whole text. Lets say "This is the example text" is my whole text, i want to save this as "This is the {example} text". Basically the blue colored text has ...

13. Color text in JTextArea    coderanch.com

15. change a color of a particular line in jtextarea    coderanch.com

i am using jtextarea containing nearly 1000 lines but i want only a particular line that appears after some interval(not constant interval) so i want to change the color of text only of that particular line. that line which is being repeated is stored in a string sample code : String end="----------------------////-------------------------------Question " +String.valueOf(o)+ " Ends-----------------------------////-----------------------------------"; questionlistarea.append(end); //want to change color ...

16. how to set multiple colors in a JtextArea    java-forums.org





17. Varying colors within JTextArea    java-forums.org

18. Different text color in JTextArea    java-forums.org

Hi everyone. I am testing a application where I have a JTextArea. In that text area I want some text with black text and another text with red color(for error messages). But when I change color at the text area it change the whole area(all text) and not the color I just set before I append the text. In my method ...

19. JTextArea text color    forums.oracle.com

20. JTextArea PArtiular Text Color    forums.oracle.com

21. JTextArea with two different text colors    forums.oracle.com

Hello, i have looked around the forum to find this answer but no luck. does anyone know if it is poissble to have two colors for text on a jtextarea. I used jtextarea.setforeground(Color.RED) but it changeds the color of all the text in the jtextarea. I also tried jtextarea.setselectedtextcolor(); but no luck. anyone knows this thanks martin

22. Colors on JTextArea    forums.oracle.com

mmmm well, sorry if I posted in the wrong place, but for not doing a cross post I will continue here. I did this: TP is my JTextPane TP.getDocument ().insertString (.......); The problem is the AttributeSet that I must pass as parameter, The API says that its an interface that represents a set of configurations and styles, but how can I ...