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

Continuously pressing Ctrl+F4 in a JDesktopPane causes Exception

XMLWordPrintable

    • beta
    • generic, x86
    • generic, windows_2000



      Name: krT82822 Date: 12/21/98


      Continuously pressing Ctrl+F4 (or a Look and Feel specific shortcut for closing a frame) in a JDesktopPane causes an
      ArrayIndexOutOfBoundsException.

      Output:
      Exception occurred during event dispatching:
      java.lang.ArrayIndexOutOfBoundsException: 0
          at javax.swing.plaf.basic.BasicDesktopPaneUI$CloseAction.actionPerformed(BasicDesktopPaneUI.java:184)
          at javax.swing.KeyboardManager.fireBinding(Compiled Code)
          at javax.swing.KeyboardManager.fireKeyboardAction(Compiled Code)
          at javax.swing.JComponent.processKeyBindingsForAllComponents(Compiled Code)
          at javax.swing.JComponent.processKeyBindings(Compiled Code)
          at javax.swing.JComponent.processKeyEvent(JComponent.java:1462)
          at java.awt.Component.processEvent(Compiled Code)
          at java.awt.Container.processEvent(Compiled Code)
          at java.awt.Component.dispatchEventImpl(Compiled Code)
          at java.awt.Container.dispatchEventImpl(Compiled Code)
          at java.awt.Component.dispatchEvent(Compiled Code)
          at java.awt.LightweightDispatcher.processKeyEvent(Container.java:1671)
          at java.awt.LightweightDispatcher.dispatchEvent(Compiled Code)
          at java.awt.Container.dispatchEventImpl(Compiled Code)
          at java.awt.Window.dispatchEventImpl(Compiled Code)
          at java.awt.Component.dispatchEvent(Compiled Code)
          at java.awt.EventQueue.dispatchEvent(Compiled Code)
          at java.awt.EventDispatchThread.run(EventDispatchThread.java:68)
      (Review ID: 48584)
      ======================================================================

      Name: ks88420 Date: 08/24/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


      [This can be seen as a more specific report than #4199075
       or as an addition to #4199075's description]

      Closing the last/only JInternalFrame in a JDesktopPane
      using the keyboard shortcut Ctrl+F4 causes an
      ArrayIndexOutOfBoundsException. Apparently the UI
      tries to select the next internal frame when there
      is none. The problem doesn't appear when the mouse
      is used to close the internal frame (by clicking
      on the X icon).

      ===

      Test case:

      import java.awt.*;
      import javax.swing.*;

      public class JIFCloseTest extends JFrame {
        public JIFCloseTest() {
          super("JIFCloseTest");
          
          JDesktopPane dsktpPn = new JDesktopPane();
          
            JInternalFrame intFrm = new JInternalFrame("JInternalFrame");
            intFrm.setClosable(true);
            intFrm.setBounds(new Rectangle(16, 16, 300, 200));
            dsktpPn.add(intFrm);
            
          setContentPane(dsktpPn);
          
          setSize(new Dimension(608, 384));
          setLocation((getToolkit().getScreenSize().width - getWidth()) / 2,
            ((getToolkit().getScreenSize().height) - getHeight()) / 2);
            
          show();
          
          intFrm.setVisible(true);
        }
        
        public static void main(String[] args) {
          new JIFCloseTest();
        }
      }

      ===

      Stack trace:

      Exception occurred during event dispatching:
      java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
      at java.util.Vector.elementAt(Vector.java:417)
      at
      javax.swing.plaf.basic.BasicDesktopPaneUI$NavigateAction.actionPerformed
      (BasicDesktopPaneUI.java:444)
      at javax.swing.plaf.basic.BasicDesktopPaneUI$CloseAction.actionPerformed
      (BasicDesktopPaneUI.java:279)
      at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1702)
      at javax.swing.JComponent.processKeyBinding(JComponent.java:2156)
      at javax.swing.JComponent.processKeyBindings(JComponent.java:2193)
      at javax.swing.JComponent.processKeyEvent(JComponent.java:2119)
      at java.awt.Component.processEvent(Component.java:3555)
      at java.awt.Container.processEvent(Container.java:1164)
      at java.awt.Component.dispatchEventImpl(Component.java:2595)
      at java.awt.Container.dispatchEventImpl(Container.java:1213)
      at java.awt.Component.dispatchEvent(Component.java:2499)
      at java.awt.LightweightDispatcher.processKeyEvent(Container.java:2155)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2135)
      at java.awt.Container.dispatchEventImpl(Container.java:1200)
      at java.awt.Window.dispatchEventImpl(Window.java:912)
      at java.awt.Component.dispatchEvent(Component.java:2499)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:319)
      at java.awt.EventDispatchThread.pumpOneEvent
      (EventDispatchThread.java:103)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
      (Review ID: 108488)
      ======================================================================

            joutwatesunw Joshua Outwater (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: