File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes setFont() question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setFont() question" Watch "setFont() question" New topic

setFont() question

Mike Brown

Joined: Oct 19, 2003
Posts: 25
Hi, I am studying Java and am stuck with a newbie problem. I need to display my name in every font size from 4 to 24 in a swing applet. I can set up the loop no problem. I was thinking that I will need to somehow pass the counter from the loop as an argument to the setfont() method? That would be my font size increasing? I need to have three arguments for defining the new font.The font size being the last one. I know that much. What is the best way to do this? Am I totaly going about this the wrong way?Oh well I hope I explained it properly. Please help if you can. Thank you all for your time.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Phil!
I'm moving this to the Swing / JFC / AWT forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
You can use deriveFont(newSize) on Font to create new Font with specified size.
I agree. Here's the link:
subject: setFont() question
It's not a secret anymore!