• Post Reply Bookmark Topic Watch Topic
  • New Topic

Window Closing Problem  RSS feed

 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hello everyone,

This window I am creating in refusing to close I created a class called Box which extends Frame and uses another class I made called Controller as its listener for both the buttons in the panel and window buttons on top. But buttons work fine but not the X button. I've tried both w.dispose() and System.exit(0) both neither work. Chances are this could be another Vista problem, could any none-Vistas test it for me please. Or simply tell me what's wrong with the code if that's the case.

Thank you
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when you use the adapter classes, any mis-spelling of the method you intend to
override just creates another method

//public void WindowClosing(WindowEvent we){//case matters - small 'w'
public void windowClosing(WindowEvent we){

before changing it, add this line and see what happens

@Override//<--------
public void WindowClosing(WindowEvent we){
 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good god! How stupid of me not to spot that!

Thanks loads though works.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Olivier Legat:
Good god! How stupid of me not to spot that!


Not at all. Lots of people make that mistake, and if you aren't familiar with it, it is very difficult to find.
 
Olivier Legat
Ranch Hand
Posts: 176
Chrome Mac Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well thanks for the encouragement
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Olivier Legat:
Well thanks for the encouragement


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!