• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error : Class WindowAdapter() not found

 
Archana Nangia
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code gives me compiler error Class WindowAdapter() not found
myWindow.addWindowListener (new WindowAdapter(){
public void windowClosing (WindowEvent e) {
System.exit(0);
}
Could someone explains me why???
to tell you I am a novice in JAVA applets.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forget to put ); at the end
Here is the code:
myFrame.addWindowListener(
new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);//terminate the program
}//end windowClosing()
}//end WindowAdapter
);//end addWindowListener
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Sorry I forgot to tell this:did put the following ?
import java.awt.*;
import java.awt.event.*;
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Archie:
The following code gives me compiler error Class WindowAdapter() not found
myWindow.addWindowListener (new WindowAdapter(){
public void windowClosing (WindowEvent e) {
System.exit(0);
}
Could someone explains me why???
to tell you I am a novice in JAVA applets.

use:
import java.awt.*;
import java.awt.event.*;
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic