Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, I think Finally, I think you shouldn't use <code>desktop.add(internalFrame, new Integer(1))</code> but rather <code>desktop.add(internalFrame)</code> instead, the reason is that <code>JDesktopPane</code> uses its layers (it is a <code>JLayeredPane</code> subclass) internally, and I don't think you should play with layers yourself.</p> <p>Then, following <a href="http://jfpoilpret.blogspot.com/2009/02/jinternalframe-lesson-learned.html" rel="nofollow">this problem</a> I had once with <code>JInternalFrame</code>, I would advise you call <code>pack()</code> <strong>after</strong> adding the internal frame to the desktop pane.</p> <p>Hence, you should try with your OpenListener class looking like this:</p> <pre><code>class OpenListener implements ActionListener { public void actionPerformed(ActionEvent e) { if ((internalFrame == null) || (internalFrame.isClosed())) { internalFrame = new JInternalFrame("Internal Frame", true, true, true, true); internalFrame.setBounds(50, 50, 200, 100); internalFrame.add(myTabbedPaneSample, BorderLayout.CENTER); internalFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // internalFrame.pack(); internalFrame.setMinimumSize(new Dimension(300, 300)); // desktop.add(internalFrame, new Integer(1)); desktop.add(internalFrame); internalFrame.pack(); internalFrame.setVisible(true); } } } </code></pre> <p>Besides, I also agree with trashgod comments on <code>Action</code> of course and the simplifying rework he has done on your snippet.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload