Re: Multicolored output
- From: CHAFIK Wassime <wassimec@xxxxxxxx>
- Date: Sat, 22 Mar 2008 18:55:13 +0100
Eustace wrote:
I am translating an old QBasic program, that is doing a kind of scan producing an array of digits and printing them on the screen forming a rectangle. In this program I have assigned different colors to different numbers so that it looks like a map, with different colored areas. The result looks something like the first square bellowHi
6 6 5 4 4 5 5 6 6 7 b b c c c c c b b b
5 5 4 4 3 3 4 5 5 6 c c c c c c c c c b
4 3 3 2 2 2 3 4 4 5 c c c c c c c c c c
2 2 2 1 1 1 2 3 3 4 c c c y y y c c c c
2 1 1 0 0 0 1 2 2 2 c y y y y y y c c c
3 2 1 0 0 0 0 1 1 2 c c y y y y y y y c
3 2 2 1 1 0 1 1 2 3 c c c y y y y y c c
3 3 2 2 1 1 2 2 3 3 c c c c y y c c c c
4 3 3 3 3 2 2 3 3 4 c c c c c c c c c c
4 4 4 4 4 4 4 3 4 4 c c c c c c c c c c
5 5 5 5 5 5 5 5 5 5 c c c c c c c c c c
5 5 5 6 6 6 6 6 6 6 c c c b b b b b b b
With 0-1 digits assigned color yellow, 2-5 color cyan, 5-9 colored blue, the effect is like in the second square, where you can "see" a yellow "island" in the center, within a "shallow sea" of cyan, and "deep sea" of blue.
I understand that in Java I can't use different colored text within a
text area. What's the simplest other option?
Eustace
i do think that a JTextPane may be what you are looking for
.
- Follow-Ups:
- Re: Multicolored output
- From: Mishagam
- Re: Multicolored output
- Prev by Date: Re: Interesting Java interview question
- Next by Date: Re: Multicolored output
- Previous by thread: Controlling PDF file through the Web
- Next by thread: Re: Multicolored output
- Index(es):
Relevant Pages
|
|