I don't know how to use println with diferent color of text from
default and to print ascii of card signes, like hearts, spike, etc...
like: System.out.println("This text is RED, and this is BLUE")
Thnx
Oliver Wong - 29 Nov 2005 22:39 GMT
>I don't know how to use println with diferent color of text from
> default and to print ascii of card signes, like hearts, spike, etc...
>
> like: System.out.println("This text is RED, and this is BLUE")
>
> Thnx
Colors are terminal specific (and thus OS specific (and thus probably
you won't find direct support for that within Java)). Try looking up ANSI as
a starting point.
For the card suits and things like that, you can probably find
appropriate symbols in Unicode, which Java fully supports.
- Oliver
zero - 29 Nov 2005 22:41 GMT
"babo" <moron68@hotmail.com> wrote in news:1133303338.159155.299140
@g49g2000cwa.googlegroups.com:
> I don't know how to use println with diferent color of text from
> default and to print ascii of card signes, like hearts, spike, etc...
>
> like: System.out.println("This text is RED, and this is BLUE")
>
> Thnx
There currently is no way to change the colour of the output on the console
window.
There are no ascii heart or spike symbols, so that's out too.
You may want to look into using a Swing GUI with a JEditorPane.

Signature
Beware the False Authority Syndrome
babo - 29 Nov 2005 22:52 GMT
#include <stdio.h>
#include <conio.h>
int main () {
char i;
for (i=0;i<=102;i++)
{
printf ("\n%2c %4d",i,i);
}
getch ();
}
//this will print You a ascii hearts and spikes in the begining???and
then the letters
Luc The Perverse - 30 Nov 2005 01:07 GMT
> #include <stdio.h>
> #include <conio.h>
[quoted text clipped - 10 lines]
> //this will print You a ascii hearts and spikes in the begining???and
> then the letters
But . . . um . .that's not a java program :)
--
LTP
:)
babo - 29 Nov 2005 22:52 GMT
#include <stdio.h>
#include <conio.h>
int main () {
char i;
for (i=0;i<=102;i++)
{
printf ("\n%2c %4d",i,i);
}
getch ();
}
//this will print You a ascii hearts and spikes in the begining???and
then the letters
//ofcourse in c language ...
zero - 30 Nov 2005 00:00 GMT
"babo" <moron68@hotmail.com> wrote in news:1133304747.771614.207220
@g44g2000cwa.googlegroups.com:
> #include <stdio.h>
> #include <conio.h>
[quoted text clipped - 12 lines]
>
> //ofcourse in c language ...
This is because the first 32 ASCII characters are non-printing characters
such as tab, newline, backspace, escape, ... How these are represented
depends greatly on the implementation, the platform, and the platform's
settings. Try running this same C program before and after setting the
KEYB setting on DOS systems (I don't know if it still works on 32 bit
windows systems). You will get very different results.
You can see the complete ASCII table at http://www.asciitable.com/ Compare
the output from your code above to the table, and you will see that the
first 32 characters come out differently, but after that it should be the
same.
The bottom line is, you can't do what you want in ASCII code. Unicode
might help, but you're still not going to get the colours you mentioned in
your first post.
Why do you want this in the console window anyway? If you want something
that looks nice, you really need a GUI.

Signature
Beware the False Authority Syndrome
Roedy Green - 30 Nov 2005 00:11 GMT
>I don't know how to use println with diferent color of text from
>default and to print ascii of card signes, like hearts, spike, etc...
Consoles don't support colour. You have to create your own logging
window that supports colour.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Jeffrey Schwab - 30 Nov 2005 00:57 GMT
>>I don't know how to use println with diferent color of text from
>>default and to print ascii of card signes, like hearts, spike, etc...
>
> Consoles don't support colour. You have to create your own logging
> window that supports colour.
Most consoles do support color. The problem is that different consoles
support color in different ways. There are libraries that can shield
applications from the differences between different console interfaces.
A quick Google turns up this library, which I have not used:
http://sourceforge.net/projects/javacurses/
Alternatively, if the output is meant only for logging, it might be
easier to write some kind of rich text, e.g. HTML. If the output is to
be read in real-time, and color is absolutely necessary, Swing might be
the best option.
Roedy Green - 30 Nov 2005 02:18 GMT
On Wed, 30 Nov 2005 00:57:29 GMT, Jeffrey Schwab
<jeff@schwabcenter.com> wrote, quoted or indirectly quoted someone who
said :
>Most consoles do support color.
Console as a special meaning in java. It does not just mean a log
display. It is implemented in a platform independent way, which is
why no colour.
It is surprisingly easy to write your own console log class that has
colour, timestamping, persistence etc.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.