actionPerformed not being called properly by child component
posted 11 years ago
Hi, I'm having a problem with the actionPerformed method, which is meant to respond to a button click. It's working fine in my parent class, but when I call the parent constructor (which creates the panel holding the button) through a child component, the button gets drawn correctly but does not respond to mouse clicks. Here is some of my parent code:
I have commented in capital letters at the point which I think is causing this problem... in the File Chooser example available on the web (FileChooserDemo.java), they use showOpenDialog(FileChooserDemo.this), whereas I am using null. PS: I have another problem which I have commented in capital letters. After reading the file, I want to show the message Opening file: (file name) before disposing of the frame. However, when I tried to put a pause statement using a thread, or even just use a long for statement, in the place I have second place I have commented, it just drew a grey window, and then exited after the pause. If anyone knows how to resolve this problem too, that would be great. Thanks a lot.