• Post Reply Bookmark Topic Watch Topic
  • New Topic

debug!!!!!!  RSS feed

 
fengqiao cao
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, there
i compiled the following code and got three strange erro( jdk1.3.1), and i couldn't fix it. could you help me out?
Thanks in Advance.....
import java.awt.*;
import java.awt.event.*;
public class SimpleWindow extends Frame{
QuitHandler quithandler;//creat a listener
public SimpleWindow(){
super("SimpleWindow");
Button quitButton = new Button("quit");
setLayout(new FlowLayout(FlowLayout.CENTER));
add(quitButton);
QuitHandler quithandler = new QuitHandle(this);
quitButton.addActionListener(quithandler);
pack();
setVisible(true);
}

public static void main(String args[]){
new SimpleWindow();
}}
//define QuitHandler class
class QuitHandler implements ActionListener{
private SimpleWindow application;
public QuitHandler(SimpleWindow window){
application= window;

public void actionPerformed(ActionEvent evt){
if (evt.getSource()==application.quitButton){
System.out.println("Quitting the application");
application.dispose();
System.exit(0);
}

}
}
}
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
correct code follows. You just had some syntax errors

HIH
------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!