public void actionPerformed(ActionEvent actOwner) { try { if (actOwner.getSource() == jmiLogin) { oFrmLogin = new FrmLogin(this); jdpDesktopForm.add(oFrmLogin); oFrmLogin.setVisible(true); } else if (actOwner.getSource() == jmiExit) { dispose(); } else if (actOwner.getSource() == jmiObjectLink_To_File) { if (ifrmTo_File == null) { ifrmTo_File = (From_ObjectLink_To_File) createNewInstance(ifrmTo_File , From_ObjectLink_To_File.class); ifrmTo_File = new From_ObjectLink_To_File(oSession); jdpDesktopForm.add(ifrmTo_File); ifrmTo_File.setVisible(true); } else { ifrmTo_File.toFront(); ifrmTo_File.setSelected(true); } } else if (actOwner.getSource() == jmiFile_To_ObjectLink) { ifrmTo_ObjectLink = new From_File_To_ObjectLink(oSession); jdpDesktopForm.add(ifrmTo_ObjectLink); ifrmTo_ObjectLink.setVisible(true); } //System.out.println("Desktop count " + jdpDesktopForm.countComponents()); } catch (PropertyVetoException excPropertyVeto) { MsgBox_With_Details.showMessage(this, "Set Selected Form Error", excPropertyVeto.getLocalizedMessage() , MsgBox_With_Details.OK_BUTTON, excPropertyVeto.getMessage()); } } private Object createNewInstance(JInternalFrame pTargetForm, Class pClass) { if (pTargetForm == null) { System.out.println("Create instance"); try { //--Get Constructor Constructor constructor = pClass.getConstructor(new Class[]{IDfSession.class}); //--Get parameter Object param[]= {oSession}; //--Create new Intance return constructor.newInstance(param); } catch (Exception exc) { MsgBox_With_Details.showMessage(this, "Object Creating Error", exc.getLocalizedMessage() , MsgBox_With_Details.OK_BUTTON, exc.getMessage()); } } return null; }