• Post Reply Bookmark Topic Watch Topic
  • New Topic

font in JOptionPane.showInputDialog  RSS feed

 
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: 9406
12
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
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't know if this will give you the effect you want, but something to play around with
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!