Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Error on page

  Asked By: Adella    Date: Sep 29    Category: Java    Views: 619

i have this error..can anyone help me with this..
here is the code..

import java.applet.*;
import java.awt.*;

public class DialogBox
private static Dialog d;

public static void main(String args[])
Frame window = new Frame();

// Create a modal dialog
d = new Dialog(window, "Alert", true);

// Use a flow layout
d.setLayout( new FlowLayout() );

// Create an OK button
Button ok = new Button ("OK");
ok.addActionListener(new ActionListener()
public void actionPerformed( ActionEvent e )
// Hide dialog

d.add( new Label ("Click OK to continue"));
d.add( ok );

// Show dialog

here is the error

symbol : class ActionListener
location: class DialogBox
ok.addActionListener(new ActionListener()



2 Answers Found

Answer #1    Answered By: Grace Ellis     Answered On: Sep 29

make sure that you have imported the event package.

Answer #2    Answered By: Alisha Johnson     Answered On: Sep 29

put import  java.awt.event.* at the top

Didn't find what you were looking for? Find more on Error on page Or get search suggestion and latest updates.