-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
beta
-
x86
-
windows_nt
Name: krT82822 Date: 03/16/2000
/* 16 Mar 2000, eval1127@eng -- verified...and no dupe found.
C:\>java -version
java version "1.3.0rc1" (and kestrel-rc1, 1.3.0rc2-W)
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
*/
/*
This error occurs on both Windows NT 4.0 SP 4 and on Windows 95 release B
This bug occurs under jdk1.3rc1:
C:\>java -version
java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
BUT, the bug does NOT occur under jdk1.2.2:
C:\>jdk1.2.2\bin\java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
The specific error that occurs is:
Exception occurred during event dispatching:
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Vector.java:441)
at
javax.swing.plaf.basic.BasicDesktopPaneUI$NavigateAction.actionPerformed(BasicDe
sktopPaneUI.java:444)
at
javax.swing.plaf.basic.BasicDesktopPaneUI$CloseAction.actionPerformed(BasicDeskt
opPaneUI.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:1163)
at java.awt.Component.dispatchEventImpl(Component.java:2595)
at java.awt.Container.dispatchEventImpl(Container.java:1212)
at java.awt.Component.dispatchEvent(Component.java:2499)
at java.awt.LightweightDispatcher.processKeyEvent(Container.java:2131)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2111)
at java.awt.Container.dispatchEventImpl(Container.java:1199)
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)
To reproduce the bug:
1. Compile and run the enclosed application
2. Click on File
3. Click on New
4. Click on the title bar of the internal frame to give it focus
5. Press Control-F4 to close the internal frame. The error will occur.
I bundled the Internal frame as an inner class to make it easier to send to
you. The error occurs in every internal frame application we have, inner class
or not.
*/
//package ssi.javabugs;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MDICF4Bug extends JFrame implements ActionListener
{
private JPanel topPanel;
private JMenuItem menuFileNew;
private JDesktopPane desktopPane;
public MDICF4Bug()
{
setTitle("MDI Control-F4 Bug");
setSize(600,400);
topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
getContentPane().add(topPanel);
JMenu menuFile = new JMenu("File");
menuFile.setMnemonic('F');
menuFileNew = CreateMenuItem(menuFile,"New",
'N',"Create new internal frame");
JMenuBar menuBar = new JMenuBar();
menuBar.add(menuFile);
setJMenuBar(menuBar);
desktopPane = new JDesktopPane();
topPanel.add(desktopPane,BorderLayout.CENTER);
this.addWindowListener (new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent event)
{
//System.out.println(event);
TestInternalFrame internalFrame = new TestInternalFrame();
desktopPane.add(internalFrame,JLayeredPane.PALETTE_LAYER);
}
public JMenuItem CreateMenuItem (JMenu menu, String sText,
int acceleratorKey, String sToolTip)
{
JMenuItem menuItem = new JMenuItem();
menuItem.setText(sText);
if (acceleratorKey > 0)
menuItem.setMnemonic(acceleratorKey);
if(sToolTip != null)
menuItem.setToolTipText(sToolTip);
menuItem.addActionListener(this);
menu.add(menuItem);
return menuItem;
}
public static void main(String[] args)
{
MDICF4Bug mDICF4Bug = new MDICF4Bug();
mDICF4Bug.setVisible(true);
}
// Internal class
class TestInternalFrame extends JInternalFrame
{
private JPanel topPanel;
private JScrollPane scrollPanel;
public TestInternalFrame()
{
setClosable(true);
setMaximizable(true);
setIconifiable(true);
setResizable(true);
setTitle("Internal Frame");
setSize(300,200);
topPanel = new JPanel();
topPanel.setLayout(new BorderLayout());
getContentPane().add(topPanel);
CreateTopPane(topPanel);
setVisible(true);
}
private void CreateTopPane(JPanel topPanel)
{
JTextArea area = new JTextArea();
try
{
FileReader fileStream = new FileReader("MDICF4Bug.java");
area.read(fileStream,"MDICF4Bug.java");
}
catch (FileNotFoundException e)
{
System.out.println("File not found.");
}
catch (IOException e)
{
System.out.println("IOException occurred.");
}
scrollPanel = new JScrollPane();
scrollPanel.getViewport().add(area);
topPanel.add(scrollPanel,BorderLayout.CENTER);
}
}
}
(Review ID: 102551)
======================================================================