• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

debug!!!!!!  RSS feed

 
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);
}

}
}
}
 
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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!