• Post Reply Bookmark Topic Watch Topic
  • New Topic

applet color and font  RSS feed

 
Carolin Sha
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am new to applets and I am trying to create a program to display color and font. Please see my code below, I am getting some errors below.
any help would be appreciated.



java:11: error: cannot find symbol
Color skyBlue;
^
symbol: class Color
location: class AdditionApplet
java:12: error: cannot find symbol
Font sansFont;
^
symbol: class Font
location: class AdditionApplet
java:18: error: cannot find symbol
skyBlue=new Color(119,201,255);
^
symbol: class Color
location: class AdditionApplet
java:19: error: cannot find symbol
sansFont=new Font("SanSerif", Font.ITALIC, 20);
^
symbol: class Font
location: class AdditionApplet
.java:19: error: cannot find symbol
sansFont=new Font("SanSerif", Font.ITALIC, 20);
^
symbol: variable Font
location: class AdditionApplet
.java:49: error: cannot find symbol
g.setColor(Color.skyBlue);
^
symbol: variable Color
location: class AdditionApplet
6 errors

Process completed.







 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to make sure that you import the classes that you use, such as class Color and class Font. Add the appropriate import statements at the top of your source file.
 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classes Color and Font are not in java.lang package so you need to import them.

Add this to your code:
 
Carolin Sha
Ranch Hand
Posts: 68
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks alot, that worked.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!