java.io.FilenameFilter type1 = new ExtensionFilter("PatchEdit Scene Files",".scenelib");
java.io.FilenameFilter type1 = new ExtensionFilter("PatchEdit Scene Files (*.scenelib)",".scenelib");
            public void internalFrameClosing(InternalFrameEvent e) {                if (!changed) return;                                int i;                javax.swing.JInternalFrame[] jList =PatchEdit.desktop.getAllFrames();                                for (int j=0;j<jList.length;j++) {                    if (jList[j] instanceof BankEditorFrame) {                        for (i=0;i<myModel.sceneList.size();i++)                            if (((BankEditorFrame)(jList[j])).bankData==((Scene)myModel.sceneList.get(i)).getPatch())                            { jList[j].moveToFront();                              try{jList[j].setSelected(true);                              jList[j].setClosed(true); }catch (Exception e1){}                              break;}                    }                                        if (jList[j] instanceof PatchEditorFrame) {                        for (i=0;i<myModel.sceneList.size();i++)                            if (((PatchEditorFrame)(jList[j])).p==((Patch)(myModel.sceneList.get(i))))                            { jList[j].moveToFront();                              try{jList[j].setSelected(true);                              jList[j].setClosed(true); }catch (Exception e1){}                              break;}                    }                }                                if (JOptionPane.showConfirmDialog(null,"This Scene may contain unsaved data.\nSave before closing?","Unsaved Data",JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) return;                                if (getTitle().startsWith("Unsaved Scene")) {                    java.awt.FileDialog fc2=new java.awt.FileDialog(PatchEdit.instance);                    java.io.FilenameFilter type1 = new ExtensionFilter("PatchEdit Scene Files",".scenelib");                    fc2.setMode(fc2.SAVE);		    fc2.setFile("Untitled.scenelib");                    fc2.setFilenameFilter(type1);                    		    fc2.show();                                        if (fc2.getFile() != null) {		        File file = new File(fc2.getDirectory(),fc2.getFile());                                                try {                            if (!file.getName().toUpperCase().endsWith(".SCENELIB"))                                file=new File(file.getPath()+".scenelib");                                                        if (file.isDirectory())                            { ErrorMsg.reportError("Error", "Can not save over a directory");                              return;                            }                                                        if (file.exists())                                if (JOptionPane.showConfirmDialog(null,"Are you sure?","File Exists",JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) return;                                                        save(file);                        } catch (Exception ex) {                            ErrorMsg.reportError("Error", "Error saving File",ex);                        }                    }                    return;                }                                try {                    save();                } catch (Exception ex)                {};            }