freelanceprogrammers.org Forum Index » Java

Setting font in TextField


View user's profile Post To page top
ooomadhatterooo Posted: Sat Feb 16, 2002 12:46 am


Joined: 31 Jan 2002

Posts: 26
Setting font in TextField
I`m trying to change the font in a text field,
but it won`t compile. This is what I did:<br><br>Font
boldFont = new Font ("Courier", Font.BOLD,
12);<br>errorF.setFont(boldFont);<br><br>The error
is:<br>C:JavaComputerScienceSemester2courseworkstudentsProjListRecFrame.jav
a:55: &lt;identifier&gt;
expected<br> errorF.setFont(boldFont);<br>
^<br>C:JavaComputerScienceSemester2courseworkstudentsProjListRecFrame.java:
55: cannot resolve symbol<br>symbol : class setFont
<br>location: package errorF<br> errorF.setFont(boldFont);<br>
^<br>2 errors<br><br>Can anyone help?
Reply with quote
Send private message
View user's profile Post To page top
ooomadhatterooo Posted: Sat Feb 16, 2002 12:53 am


Joined: 31 Jan 2002

Posts: 26
Setting font in TextField
Oops, actually it`s a TextArea - but probably doesn`t make any difference?
Reply with quote
Send private message
View user's profile Post To page top
babe_in_bush85 Posted: Sat Feb 16, 2002 1:46 am


Joined: 08 Feb 2002

Posts: 8
Setting font in TextField
In your error message:<br>symbol : class setFont
<br>location: package
errorF<br>errorF.setFont(boldFont);<br><br>It appears as if the setFont method
is being
interpreted as a class, and the TextArea object is being
interpreted as a package. Double check your package, class
and object definitions.
Reply with quote
Send private message
View user's profile Post To page top
epenak Posted: Sat Feb 16, 2002 2:17 am


Joined: 31 Jan 2002

Posts: 39
Setting font in TextField
Whenever you see something like
this:<br><br>errorF.setFont(boldFont);<br>^<br><br>The ^, or caret is usu.
pointing at the problem. In
this case, the interpreter doesn`t recognize the
variable errorF.<br><br>The other poster on this topic is
correct. Go check your declaration for errorF. Look for
bad spelling or package typo.<br><br>epenak
Reply with quote
Send private message
View user's profile Post To page top
ooomadhatterooo Posted: Sat Feb 16, 2002 2:58 am


Joined: 31 Jan 2002

Posts: 26
Setting font in TextField
Thanks. The problem was that "errorF.setFont(boldFont);" got put with the
instance vars by mistake, instead of in the constructor - dumb of me...
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help