• Post Reply Bookmark Topic Watch Topic
  • New Topic

font in JOptionPane.showInputDialog

 
Bud Stambaugh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to be able to set font properties such as size and bold in a showInputDialog box. The code for the InputDialog box is:

code
String message =JOptionPane.showInputDialog(null,question + "------ type answer below","The QUESTION is: ",JOptionPane.DEFAULT_OPTION);
code

I have tried the following code but keep getting errors about ": non-static method setFont(java.awt.Font) cannot be referenced from a static context"

code
public Font font;
int font_size = 14;
font = new Font("sansserif",Font.BOLD, font_size);
JOptionPane.setFont(font);
code

Any help will be highly appreciated Bud
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to move this to the Swing forum
Follow up in this topic
[ March 01, 2005: Message edited by: Joe Ess ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!