| Author |
how to set the font type for a "string"
|
Peter Primrose
Ranch Hand
Joined: Sep 10, 2004
Posts: 755
|
|
hi there, Does anyone know how to change the color and font for a String? I'd like my result to be like: System.out.println("Due Date:" + record.getDueDate() "); how can I make the record.getDueDate() with .setFont() ??? Thanks for any help
|
 |
Elouise Kivineva
Ranch Hand
Joined: Feb 07, 2002
Posts: 154
|
|
System.out.println prints to a DOS window that is always 2 colors (background and text) and a standard font. ---- If you were to print using a graphics object on something that could produce Fonts and colors you would do this: Create a new Font Object with the desired characteristics (see Java API for Font constructors). Set the font of your graphics object using the setFont method and your newly-created Font object. Set the color of your graphics object using the setColor method and a static object of the Color class (see classes Graphics and Color in the Java API as needed). Now print using the graphics object.
|
 |
Nigel Browne
Ranch Hand
Joined: May 15, 2001
Posts: 673
|
|
|
Have a look at the working with text and fonts tutorial
|
 |
 |
|
|
subject: how to set the font type for a "string"
|
|
|