admiral
asked on
J++
import java.awt.event.*;
gives me an error, Undefined package 'event'
I use version 1.0 ?
gives me an error, Undefined package 'event'
I use version 1.0 ?
ASKER
I tried the code you gave - it would not compile
Here is all the code if it can help:
thank you
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class ThirdMethod extends Applet implements ActionListener
{
Label theLabel= new Label("Enter your first name");
TextField theName= new TextField(20);
Button pressMe = new Button("Ok");
public void init()
{
add(theLabel);
add(pressMe);
add(theName);
pressMe.addActionListener( this);
}
public void actionPerformed(ActionEven t theEvent)
{
String newText;
String usersName;
usersName= theName.getText();
newText=getGreeting(userNa me);
theLabel.setText(newText);
}
public String getGreeting(String Name)
{
String greeting;
greeting ="Hi" + Name +"!";
return greeting;
}
}
Here is all the code if it can help:
thank you
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
public class ThirdMethod extends Applet implements ActionListener
{
Label theLabel= new Label("Enter your first name");
TextField theName= new TextField(20);
Button pressMe = new Button("Ok");
public void init()
{
add(theLabel);
add(pressMe);
add(theName);
pressMe.addActionListener(
}
public void actionPerformed(ActionEven
{
String newText;
String usersName;
usersName= theName.getText();
newText=getGreeting(userNa
theLabel.setText(newText);
}
public String getGreeting(String Name)
{
String greeting;
greeting ="Hi" + Name +"!";
return greeting;
}
}
Visual J++ 1.0/1.1 does not support Sun jdk 1.1. Your code is written with jdk 1.1 so it can't be compiled in J++.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The compiler imterprets the asterisk in your code as a package name instead of a class name.