title: How to manage a JInternalFrame calling another JInternalFrame?
body: <p>I have a JDesktopPane with this code.</p>
  
  <pre><code>public class Menu extends JFrame implements ActionListener{
  /**
   * Creates new form Portada
   */
  public static JDesktopPane desktop;
  
  public JDesktopPane getDesktop() {
      return desktop;
  }
  
  public Menu() {
      desktop = new JDesktopPane();
      setContentPane(desktop);
  
      desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
      initComponents();
  }
  }
  </code></pre>
  
  <p>then i add the new components like this</p>
  
  <pre><code>desktop.add(orden);
  </code></pre>
  
  <p>and when i want to call them i use </p>
  
  <pre><code>if(e.getSource()==jMenuItem1_1){
          orden.setVisible(true);
          desktop.setSelectedFrame(orden);
          desktop.moveToFront(orden);
          try {
              orden.setSelected(true);
          } catch (PropertyVetoException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
          }
      }
  </code></pre>
  
  <p>The problem i get is that when "orden" wants to pop out another JInternalFrame i use the next code.</p>
  
  <pre><code>searchSupplier.setVisible(true);
      Main.getInstance().getPortada().getDesktop().add(searchSupplier);
      Main.getInstance().getPortada().getDesktop()
              .moveToFront(searchSupplier);
      try {
          searchSupplier.setSelected(true);
      } catch (PropertyVetoException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  
  <p>When I execute the event more than 2 times i get the next error:</p>
  
  <pre><code>Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position
  </code></pre>
  
  <p>Where should i add the new JInternalFrame to the DesktopPane? or to Orden?, or What can i do to fix this error?</p>