prefsDialog=new PrefsDialog (PatchEdit.this); noteChooserDialog = new NoteChooserDialog (PatchEdit.this);
this.appConfig = new AppConfig(); prefsDialog=new PrefsDialog (this, this.appConfig); noteChooserDialog = new NoteChooserDialog (PatchEdit.this, this.appConfig);
    public PatchEdit ()    {        super("JSynthLib");        instance = this;              // phil@muqus.com (so can pop-up windows with PatchEdit as the                 boolean loadPrefsSuccessfull,loadDriverSuccessfull;        prefsDialog=new PrefsDialog (PatchEdit.this);        noteChooserDialog = new NoteChooserDialog (PatchEdit.this);                loadPrefsSuccessfull=loadPrefs ();        loadDriverSuccessfull=loadMidiDriver ();        MidiIn=MidiOut;                prefsDialog.init ();  //loads in the config file and sets parameters        // Now lets set up how the pretty application should look        int inset = 100;        Dimension screenSize = Toolkit.getDefaultToolkit ().getScreenSize ();        setBounds (inset, inset,        screenSize.width - inset*2,        screenSize.height-inset*2);                                //Quit this app when the big window closes.        addWindowListener (new WindowAdapter ()        {            public void windowClosing (WindowEvent e)            {                savePrefs ();                unloadMidiDriver();		System.exit (0);            }        });                //Set up the GUI.        desktop = new JDesktopPane ();        setJMenuBar (createMenus ());        desktop.setOpaque (false);        Container c=getContentPane ();        c.add (desktop,BorderLayout.CENTER);                desktop.putClientProperty ("JDesktopPane.dragMode", "outline");        setVisible (true);        if (!loadPrefsSuccessfull)            ErrorMsg.reportError ("Error", "Unable to load user preferences. Defaults loaded\n If you've just installed or just upgraded this software, this is normal.");        if (!loadDriverSuccessfull)            ErrorMsg.reportError ("Error","Unable to Initialize MIDI IN/OUT! \nMidi Transfer will be unavailable this session.\nChange the Initialization Port Settings under Preferences and restart.");                //Set up a silly little dialog we can pop up for the user to gawk at while we do time consuming work later on.        waitDialog=new WaitDialog (this);                        // Start pumping MIDI information from Input --> Output so the user can play a MIDI Keyboard and make pretty music        beginEcho ();    }