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

InternalFrame events not fired

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.3.0
    • 1.1.5, 1.1.6, 1.2.0
    • client-libs
    • beta
    • x86, sparc
    • solaris_2.6, windows_95, windows_nt



      Name: mf23781 Date: 05/14/98


      If you run the test case below and perform all the normal actions
      on one of the JInternalFrame's, i.e. open (done by clicking the add
      button), close, minimise and maximise, give one focus and then give
      something else focus (activate/deactivate) you will see the following
      events are not fired:

      DeActivated
      DeIconified
      Opened

      The deactivated and deiconified events are generated for Windows NT
      (still no opening event) but are definitely broken on Win 95.



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

      public class InternalFrameTest extends JFrame implements ActionListener
      {
      public static void main(String args[])
      {
      new InternalFrameTest();
      }

      JInternalFrame[] fArr;
         JDesktopPane dp;
         InternalFrameListener ifa; JLabel[] lb;
         JButton b;
         JInternalFrame jif;
         JLabel lbl;
          int frameCount = 1;

      public InternalFrameTest()
         {
      super ("InternalFrameEvent Test");
      // Firstly create the InternalFrame adapter;
      ifa = new myAdapter();

           dp = new JDesktopPane();
      getContentPane().add(dp, BorderLayout.CENTER);
      b = new JButton("Add");
           b.addActionListener(this);
      getContentPane().add(b, BorderLayout.SOUTH);
            // Create initial view of three internal frames
      fArr = new JInternalFrame[frameCount];
      lb = new JLabel[frameCount];
           for (int i = 0; i < frameCount; i++)
      {
      fArr[i] = new JInternalFrame("Internal Frame " + (i+1), true, true, true, true);
             lb[i] = new JLabel("Label for Frame " + (i+1));
              fArr[i].getContentPane().add(lb[i]);
             dp.add(fArr[i]);
      fArr[i].addInternalFrameListener(ifa);
      fArr[i].setSize(150, 150);
             fArr[i].setVisible(true);
           }
            // Set the size and show the desktop.
           setSize(500, 500);
      setLocation(50, 100);
           setVisible(true);
         }
          public void actionPerformed(ActionEvent e)
         {
      String cmd = e.getActionCommand();
           if (cmd.compareTo("Add") == 0)
      {
             // Add a new frame to the desktop.
      jif = new JInternalFrame("Internal Frame " + (++frameCount), true, true, true, true);
             dp.add(jif);
      lbl = new JLabel("Label for Frame " + frameCount);
      jif.getContentPane().add(lbl);
      jif.addInternalFrameListener(ifa);
             jif.setSize(150, 150);
      jif.setLocation(frameCount*10, 20);
             jif.setVisible(true);
              dp.validate();
             dp.repaint();
           }
         }
       
          class myAdapter extends InternalFrameAdapter
         {
      public void internalFrameActivated(InternalFrameEvent e)
           {
      System.out.println("Internal Frame Activated");
           }
            public void internalFrameClosed(InternalFrameEvent e)
           {
      System.out.println("Internal Frame Closed");
           }
      public void internalFrameOpened(InternalFrameEvent e)
      {
      System.out.println("Internal Frame Opened");
      }
      public void internalFrameIconified(InternalFrameEvent e)
      {
      System.out.println("Internal Frame Iconified");
      }
      public void internalFrameDeIconified(InternalFrameEvent e)
           {
      System.out.println("Internal Frame DeIconified");
           }
            public void internalFrameDeActivated(InternalFrameEvent e)
           {
      System.out.println("Internal Frame DeActivated");
           }
      public void internalFrameClosing(InternalFrameEvent e)
           {
      System.out.println("Internal Frame Closing");
           }
           
        }
      }

      This occurs on NT and Win95 under JDK 1.1.6 and Swing 1.0.2

      ======================================================================

            hgajewsksunw Hania Gajewska (Inactive)
            miflemi Mick Fleming
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: