Dlaczego nie działa exit on close yes no gdy mam set textw metodzie i jak to ominąć?
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package wypozyczalnia_filmow;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Marek
*/
public class historia_wyp_user extends Wypozycz {
JLabel ety;
public void historia_wyp_user()
{
setTitle("Historia");
setLayout(null);
setSize(900,500);
setVisible(true);
ety=new JLabel("Wyppppp");
ety.setBounds(20,20,850,850);
ety.setText( h.toString());
add(ety);
//wczyt();
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
WindowListener sl = new Zam();
addWindowListener(sl);
}
class Zam extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
int answer = JOptionPane.showConfirmDialog(null, "Czy na pewno chcesz zamknąć program", "Koniec", JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION)
{
dispose();
}
}
}
}