How can I get the name of the Jform I am using?
public class WindowInsertPacient extends javax.swing.JFrame {
private WindowMain father;
public WindowInsertPacient(WindowMain father) {
this.father = father;
initComponents();
}
private void myWindowClosing(java.awt.event.WindowEvent evt) {
Class enclosingClass = getClass().getEnclosingClass();
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
enclosingClass.this.setVisible(false);
enclosingClass.this.dispose();
father.setEnabled(true);
}
});
}
It says cannot find symbol.
>>10
Ok, I marked it final but it still doesn't recognizes the .setVisile(false) and the .dispose() methods:
private void myWindowClosing(java.awt.event.WindowEvent evt) {
final Class<?> enclosingClass = getClass().getEnclosingClass();
addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
enclosingClass.setVisible(false);
enclosingClass.dispose();
father.setEnabled(true);
}
});
}
Just by any chance WindowMain is not another instance of JFrame and you can't do [code]father.setVisible(false);
father.dispose();
father.setEnabled(true);/code]
can you?