I have frame, in this frame I have a JTable
that have button inside, this button have class with ActionListener
and so on and I need to close this frame after pressing this button. How do this?
Code example:
public class Frame2 extends JFrame{
public Frame2() {
JTable table = new JTable(model);
//...
table.getColumn("change").setCellEditor(new ButtonCellEditor());
}
public static class ButtonCellEditor extends AbstractCellEditor implements TableCellEditor{
public ButtonCellEditor() {
editor = new JButton();
editor.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//do something here
setVisible(false); //not working, I NEED HERE TO CLOSE THIS FRAME
});
}}}