File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes How to change font and font size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

How to change font and font size

Justin Char
Ranch Hand

Joined: Mar 05, 2007
Posts: 76
// new Font("Serif", Font.PLAIN, 48); doesn't work ..
Program runs fine just want to change Center to different font and font size.
strOut = ("Center (DC), " + SavedTime);

Just want to change the font of above text.

Thank You in advance. I have tried to figure this out for a long time.
I can't seem to find the answer. I am using buffered writer to write my adhoc report.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46373
Where doesn't new Font work?
Why are you asking substantially the same question on two fora?
Can you change Fonts with a BufferedWriter at all? I don't think you can.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Text doesn't have a font, except if you have a context (like a GUI) where you can apply a font to text. If you have an "adhoc report" then you will have to learn how to specify fonts in the content of that report. Read the documentation for whatever interprets the data you send it.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

Please do not post the same question in multiple forums.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: How to change font and font size
It's not a secret anymore!