Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4193294

Iconfied internal frames invisible if inconfied prior to setting main frame visi

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs



      Name: diC59631 Date: 11/27/98


      I have included the problem source, and a workaround.
      If I programatically iconify internal frames prior to
      making the main frame visible, the iconfied internal
      frames do not display as icons when the main frame is
      made visible. If any other internal frames are iconified
      after the main frame is made visible, they too become
      invisible.

      Here is the code (I used code obtained from Java World on
      how to program internal frames):

      import com.sun.java.swing.*;
      import java.awt.BorderLayout;

      public class InternalFrames extends JFrame {

         JDesktopPane desktop;
         DesktopManager manager;
         JInternalFrame f1;
         JInternalFrame f2;
         JInternalFrame f3;
         JInternalFrame f4;

         public InternalFrames()
         {
            super("Internal Frames Demo");
            desktop = new JDesktopPane();
            desktop.setOpaque(false);
            getContentPane().add(desktop,BorderLayout.CENTER);

            manager = new DefaultDesktopManager()
            {
               public void activateFrame(JInternalFrame f)
               {
                  super.activateFrame(f);
                  System.out.println(f);
               }
            };

            desktop.setDesktopManager(manager);

            JButton button;

            try
            {
            f1 = new JInternalFrame("Always Below", true,false,true,true);
            button = new JButton("Ok");
            f1.getContentPane().add(button,BorderLayout.CENTER);
            f1.setBounds(0,0,200,75);
            desktop.add(f1, new Integer(desktop.DEFAULT_LAYER.intValue()-1));

            f2 = new JInternalFrame("Default Layer #1", true,false,true,true);
            button = new JButton("Ok");
            f2.getContentPane().add(button,BorderLayout.CENTER);
            f2.setBounds(25,25,200,75);
            desktop.add(f2,desktop.DEFAULT_LAYER);
            f2.setIcon(true);

            f3 = new JInternalFrame("Default Layer #2", true,false,true,true);
            button = new JButton("Ok");
            f3.getContentPane().add(button,BorderLayout.CENTER);
            f3.setBounds(50,50,200,75);
            desktop.add(f3,desktop.DEFAULT_LAYER);
            f3.setIcon(true);

            f4 = new JInternalFrame("Always Above", true,false,true,true);
            button = new JButton("Ok");
            f4.getContentPane().add(button,BorderLayout.CENTER);
            f4.setBounds(75,75,200,75);
            desktop.add(f4, new Integer(desktop.DEFAULT_LAYER.intValue()+1));
            f4.setIcon(true);
            }
            catch( java.beans.PropertyVetoException e )
            {
               e.printStackTrace();
            }

            setSize(300,300);
            show();
         }

         public static void main(String args[])
         {
              new InternalFrames();
         }
      }
      (Review ID: 41105)
      ======================================================================

            hgajewsksunw Hania Gajewska (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: