Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Swing / AWT / SWT and the fly likes Program with 'java.awt.Choice' doesn't compile in JDK1.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Program with Watch "Program with New topic
Author

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

Saurav Chetia
Greenhorn

Joined: Oct 28, 2002
Posts: 10
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
basha khan
Ranch Hand

Joined: Jan 18, 2002
Posts: 87
hei friend ,
call the methods from constructor,cut and paste the Choice API calls to the colortest constructor. then compile ..that's all.
basha
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: Program with 'java.awt.Choice' doesn't compile in JDK1.3