This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • 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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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
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!