• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

setBackground error

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried compiling this program
import java.awt.*;
import java.applet.*;

public class Excercise extends Applet {
public void init() {

Frame f = new Frame("First Frame");
f.setSize(200,200);
String E = "Excercise- test area should not have scrollbars and should not be editable ";

TextArea ta = new TextArea(E,8,TextArea.SCROLLBARS_NONE);
ta.setEditable(false);
// ta.setBackground(Color.black);// line 1
// ta.setForeground(Color.yellow); // line 2
f.add(ta);
f.pack();
f.setVisible(true);


}
}
I am getting the folloing compiler error. ie error at line 1 and 2
Excercise java:14:No variable black defined in class Color
Excercise java:15:No variable yellow defined in class Color
can anyone pls tell me whats happening?
Am i missing something??
-bani
 
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very strange..
I copied and pasted your source code, removed the comments, and it still compiled in my machine.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also embedded the applet in an HTML page and it's working. Are you sure you are compiling the right file?
I also edited your code so that you can now close the frame:

[ August 02, 2002: Message edited by: Anthony Villanueva ]
reply
    Bookmark Topic Watch Topic
  • New Topic