public void actionPerformed(ActionEvent e) { if (isExists()) { try { main.getPenerbitView().setSelected(true); } catch (PropertyVetoException ex) { } } else { main.setPenerbitView(new FramePenerbitView(main)); main.getDesktopPane().add(main.getPenerbitView()); main.getPenerbitView().setVisible(true); } }
public boolean isExists() { boolean result = false; JInternalFrame[] iFrame = main.getDesktopPane().getAllFrames(); for (int i = 0; i < iFrame.length; i++) { if (iFrame[i].equals(main.getPenerbitView())) { result = true; break; } } return result; }