title: JInternalFrame selection
body: <p>I have a JDesktopPane containing some JInternalFrames. I want some menus on the menubar to be activated only when one of the JInternalFrames is selected. I've tried using VetoableChangeListener, with the following code in it:</p>
  
  <pre><code>JInternalFrame selectedFrame = desk.getSelectedFrame(); 
  if ((selectedFrame != null)) {  
      imageMenu.setEnabled(Boolean.TRUE);         
  } else {
      imageMenu.setEnabled(Boolean.FALSE);            
  }
  </code></pre>
  
  <p>But the results are not what I expected - for example, the menu is enabled only the second time I add a frame. when I close all frames, it remains enabled.</p>
  
  <p>How can I make this work?</p>