Skip to main content



      Home
Home » Archived » Visual Editor (VE) » How to change the colors of the Text along with different inputs?
How to change the colors of the Text along with different inputs? [message #108717] Mon, 03 October 2005 13:18 Go to next message
Eclipse UserFriend
Originally posted by: qingxing20052.gmail.com

Dear all:

I met one probelm and hope to get some helps from you.

* My scenario:
There are two buttons, A and B. When A is pressed, the word "A" which is
blue will appear in textArea. Whereas when B is pressed, the word "B" which
is red will appear in textArea. I used the following method:
A mouse down event:{
textArea.setForeground(Specific Color);}

The result: All the comment in textArea are changed along with different
pressings of A and B. E.g. When button A is firstly pressed, word "A" is
blue. After that button B is pressed, the previous word "A" and latter word
"B" are changed (red) both. It is not my expected. My expected result is:
"A" still remain in blue, only "B" is in red. I know the method
sefForeground is not fit for my requirement. But is there any other mehtod
that I can use?

Any suggestion is welcome.

I am looking forward to hearing from you.

thx for your kindness and helps.

B.W.

N.B
Re: How to change the colors of the Text along with different inputs? [message #108731 is a reply to message #108717] Mon, 03 October 2005 14:04 Go to previous message
Eclipse UserFriend
You'll have to use another class like JTextPane to apply style changes
to specific text within your editor. See this page on how to use it:
http://java.sun.com/docs/books/tutorial/uiswing/components/e ditorpane.html

- Jeff
Re: How to change the colors of the Text along with different inputs? [message #610912 is a reply to message #108717] Mon, 03 October 2005 14:04 Go to previous message
Eclipse UserFriend
You'll have to use another class like JTextPane to apply style changes
to specific text within your editor. See this page on how to use it:
http://java.sun.com/docs/books/tutorial/uiswing/components/e ditorpane.html

- Jeff
Previous Topic:How to change the colors of the Text along with different inputs?
Next Topic:What is InverseMaintenaceAdapter for?
Goto Forum:
  


Current Time: Mon Sep 15 16:13:24 EDT 2025

Powered by FUDForum. Page generated in 0.03002 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top