if(e.isPopupTrigger ()) { PatchEdit.menuPatchPopup.show (table2, e.getX (), e.getY ()); } }
Patch myPatch = ((Patch) myModel.getPatchAt(0, 0)); try { myPatch.getDriver().getClass().getDeclaredMethod("editPatch", new Class[] {myPatch.getClass()}); PatchEdit.editAction.setEnabled(true); } catch (NoSuchMethodException ex) { if (myPatch.getDriver() instanceof BankDriver) PatchEdit.editAction.setEnabled(true); } PatchEdit.cutAction.setEnabled(true); PatchEdit.copyAction.setEnabled(true); PatchEdit.deleteAction.setEnabled(true); PatchEdit.exportAction.setEnabled(true);  if (e.isPopupTrigger()) PatchEdit.menuPatchPopup.show(table2, e.getX(), e.getY()); }
            public void mousePressed (MouseEvent e)            {                table2.setRowSelectionInterval (                table2.rowAtPoint (new Point (e.getX (),e.getY ())),                table2.rowAtPoint (new Point (e.getX (),e.getY ()))                );                table2.setColumnSelectionInterval (                table2.columnAtPoint (new Point (e.getX (),e.getY ())),                table2.columnAtPoint (new Point (e.getX (),e.getY ()))                );                PatchEdit.extractAction.setEnabled (true);                PatchEdit.sendAction.setEnabled (true);                PatchEdit.sendToAction.setEnabled (false);	// not available yet!                PatchEdit.reassignAction.setEnabled (false);	// not available yet!                PatchEdit.playAction.setEnabled (true);                PatchEdit.storeAction.setEnabled (true);                Patch myPatch=((Patch)myModel.getPatchAt(0,0)); // All entries are of the same type, so we can check the first one....                try{                    myPatch.getDriver().getClass().getDeclaredMethod("editPatch", new Class[]{myPatch.getClass()});                    PatchEdit.editAction.setEnabled(true);                }                catch(NoSuchMethodException ex) {                    if (myPatch.getDriver() instanceof BankDriver)                        PatchEdit.editAction.setEnabled(true);                };                PatchEdit.cutAction.setEnabled (true);                PatchEdit.copyAction.setEnabled (true);                PatchEdit.deleteAction.setEnabled (true);                PatchEdit.exportAction.setEnabled (true);                if(e.isPopupTrigger ())                {                    PatchEdit.menuPatchPopup.show (table2, e.getX (), e.getY ());                }            }