Forums Register Login

how to set the font type for a "string"

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Have a look at the working with text and fonts tutorial
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3232 times.
Similar Threads
Change ascent value on Font LineMetrics
eligible for GC()
font size, and dialogbox
colored text in dropdown
Class definition
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 06:30:00.