Calling Container object's setVisible(boolean) method
Hi All!
I have a noobie question regarding swing.
I want to know how to call the JFrame Object's setVisible(boolean) method inside JButton object's addActionListener() method (when JButton object is a component under the JFrame object).
Code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Sample extrends JFrame{
public Sample(){
...
btnCancel.setBounds (125,90,100,25);
btnCancel.addActionListener (new ActionListener(){
public void actionPerformed(ActionEvent ae){
//Code for calling the class setVisible(boolean) method
//since this.setVisible(false) wont work
//because 'this' might point to btnCancel object not
//JFrame
}
});
...
}
}

