• 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Program with 'java.awt.Choice' doesn't compile in JDK1.3  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code -
import java.awt.*;
import java.awt.event.*;
class colorTest extends Frame {
java.awt.Choice ColorChooser = new java.awt.Choice();
ColorChooser.insert("Green",0);
ColorChooser.add("Red");
ColorChooser.add("Blue");

public colorTest() {
super("ColorTest");
}
public static void main(String args[]) {
colorTest test = new colorTest();
}
}
When I try to compile the file I get the error as given below. What could be the problem ? -
javac colorTest.java
colorTest.java:7: <identifier> expected
ColorChooser.add("Red");
^
colorTest.java:8: <identifier> expected
ColorChooser.add("Blue");
^
colorTest.java:7: cannot resolve symbol
symbol : class add
location: package ColorChooser
ColorChooser.add("Red");
^
colorTest.java:8: cannot resolve symbol
symbol : class add
location: package ColorChooser
ColorChooser.add("Blue");
^
4 errors
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hei friend ,
call the methods from constructor,cut and paste the Choice API calls to the colortest constructor. then compile ..that's all.
basha
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!