• Post Reply Bookmark Topic Watch Topic
  • New Topic

Display Font Dialog Box  RSS feed

 
Sham Usha
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to display font Dialog box in my java application.
I'm using java swing.
How to do this
Please help ASAP


Sham Nisha
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need fast help, you might want to read http://faq.javaranch.com/view?HowToAskQuestionsOnJavaRanch

Moving to our Swing forum...
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a lot of ways you can do this. One way might be to create a JDialog, load up the fonts into a component and add them to the dialog at construction. Or, since the font loading takes a little while you could do it in a background thread after the app is 'setVisible'. Or you could do it with 'lazy instantiation', ie, wait until the user asks for the dialog before you load the fonts. Then when the user asks for the font selection component (via say a JMenuItem or JButton) you can call 'setVisible' on the dialog. Get the selected font from your event listener and carry on. You could also use a JOptionPane for this.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!