• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help Setting Font Face dynamically  RSS feed

 
James Hambrick
Ranch Hand
Posts: 282
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the error nullPointerException here--mainText.setFont(newFont(fontFace,Font.PLAIN,12));--


Here the code-I edited out some of the code that was working before I added the fontList so if there's a ( or a ) missing that's probably why.

 
Gokul Nanthakumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
place this line

mainText = new JTextArea(25,50);

before

fontList = new JComboBox();

it will work, actually your code is trying to set font before mainText get initialized.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!