Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Font Chooser JComboBox (RESOLVED)

 
Mark Newton
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21133
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Splendid, couldn't have hoped for a better answer!

Thanks very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic