This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Font Chooser JComboBox (RESOLVED) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Font Chooser JComboBox (RESOLVED)" Watch "Font Chooser JComboBox (RESOLVED)" New topic
Author

Font Chooser JComboBox (RESOLVED)

Mark Newton
Ranch Hand

Joined: Jan 31, 2006
Posts: 129
Hi all,

Still not 100% certain about what makes a beginner/intermediate/advanced query, so apologies if this is in the wrong place!

Anyway, to the point - I'm trying to make a Word-style drop-down font selection list. I'm guessing that the best option is a JComboBox populated with all the fonts in my system - so the question that I'm asking is: is there a way to get a list of all my fonts?

Any other advice much appreciated!
[ February 20, 2006: Message edited by: David Payne ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

I knew there must be one, because I wrote one myself. But I wrote it a couple of years ago (so I don't remember what I did) and it's on my home computer. So I quickly checked the documentation for java.awt.Font and after scrolling down a bit I came upon this sentence:

"The getAllFonts method of the GraphicsEnvironment class returns an array of all font faces available in the system."

It goes on to explain what to do with that list, but in any case that's your starting point.
Mark Newton
Ranch Hand

Joined: Jan 31, 2006
Posts: 129
Splendid, couldn't have hoped for a better answer!

Thanks very much.
 
Don't get me started about those stupid light bulbs.
 
subject: Font Chooser JComboBox (RESOLVED)
 
Similar Threads
smoothing fonts
Changing Font
Changing Font Size on a Chart
Windows XP and Fonts
Puzzle in getting OS's FONT_SIZE