title: Close the particular JInternalFrame on button click
body: <p>I am creating more than one <code>JInternalFrame</code> in the <code>JDesktopPane</code>.  Each frame having one button.  I want to close the particular frame on which button is clicked.</p>
  
  <pre><code>internalFrame = new JInternalFrame("Internal Frame", true, true, true, true);
  
      internalFrame.setSize(300, 300);
      internalFrame.setLocation(xPosition * openFrameCount, yPosition
              * openFrameCount);
  
      internalFrame.setContentPane(createContentPane());
      internalFrame.setJMenuBar(createPopJMenuBar());
  
      internalFrame.setVisible(true);
  
      JButton close = new JButton( "Close Me!" );  
      close.addActionListener( new ActionListener() {  
          public void actionPerformed( ActionEvent e ) {
                  try {
                      internalFrame.setClosed( true );
                  } catch (PropertyVetoException e1) {
                      e1.printStackTrace();
                  }
          }  
      } );  
      internalFrame.add( close );  
      jdpDesktop.add(internalFrame);
  </code></pre>
  
  <p>By using the above code I am able to close the last created frame.  Other frames are not closed.</p>