Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Setting font in TextField

  Asked By: Dukker    Date: Aug 07    Category: Java    Views: 798

I'm trying to change the font in a text field,
but it won't compile. This is what I did:Font
boldFont = new Font ("Courier", Font.BOLD,
12);errorF.setFont(boldFont);The error
a:55: <identifier>
expected errorF.setFont(boldFont);
55: cannot resolve symbolsymbol : class setFont
location: package errorF errorF.setFont(boldFont);
^2 errorsCan anyone help?



3 Answers Found

Answer #1    Answered By: Earl Stone     Answered On: Aug 07

actually it's a TextArea - but probably doesn't make any difference?

Answer #2    Answered By: Alexander Fields     Answered On: Aug 07

Whenever you see something like
this:errorF.setFont(boldFont);^The ^, or caret is usu.
pointing at the problem. In
this case, the interpreter doesn't recognize the
variable errorF.The other poster on this topic is
correct. Go check your declaration for errorF. Look for
bad spelling or package  typo.

Answer #3    Answered By: Vivian Ruiz     Answered On: Aug 07

The problem was that "errorF.setFont(boldFont);" got put with the
instance vars by mistake, instead of in the constructor

Didn't find what you were looking for? Find more on Setting font in TextField Or get search suggestion and latest updates.