-
Bug
-
Resolution: Fixed
-
P4
-
1.2.0
-
beta
-
x86
-
windows_95
Name: krT82822 Date: 06/13/99
When I try to make 2 views of the same document in 2 JTextPanes
in a JSPlitPane and the document contains a component, it does
not function properly and generates and ArrayIndexOutOfBounds
Exception: No such child: 0. You need to resize the window to
see partial function.
SOURCE EXAMPLE:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class TextPaneTest extends JSplitPane {
public TextPaneTest ( ) {
super( JSplitPane.VERTICAL_SPLIT );
JTextPane top = new JTextPane( );
top.insertComponent( new JButton( "Test" ));
JTextPane bottom = new JTextPane( );
bottom.setDocument( top.getDocument( ) );
setTopComponent( new JScrollPane( top,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ) );
setBottomComponent( new JScrollPane( bottom,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ) );
}
public static void main ( String [ ] args ) {
JFrame f = new JFrame( );
Container c = f.getContentPane( );
c.add( new TextPaneTest( ) );
f.addWindowListener( new WindowAdapter ( ) {
public void windowClosing( WindowEvent evt ) {
System.exit( 0 );
}
} );
f.pack( );
f.setVisible( true );
f.setSize( 750, 400 );
}
}
ERROR MESSAGE AND STACK TRACE:
Exception occurred during event dispatching:
java.lang.ArrayIndexOutOfBoundsException: No such child: 0
at java.awt.Container.getComponent(Compiled Code)
at javax.swing.text.ComponentView$Invalidator.setVisible(ComponentView.j
ava:400)
at javax.swing.text.ComponentView.paint(Compiled Code)
at javax.swing.text.BoxView.paintChild(Compiled Code)
at javax.swing.text.BoxView.paint(Compiled Code)
at javax.swing.text.BoxView.paintChild(Compiled Code)
at javax.swing.text.BoxView.paint(Compiled Code)
at javax.swing.text.ParagraphView.paint(Compiled Code)
at javax.swing.text.BoxView.paintChild(Compiled Code)
at javax.swing.text.BoxView.paint(Compiled Code)
at javax.swing.plaf.basic.BasicTextUI$RootView.paint(Compiled Code)
at javax.swing.plaf.basic.BasicTextUI.paintSafely(Compiled Code)
at javax.swing.plaf.basic.BasicTextUI$SafePainter.run(Compiled Code)
at javax.swing.text.AbstractDocument.render(Compiled Code)
at javax.swing.plaf.basic.BasicTextUI.paint(Compiled Code)
at javax.swing.plaf.ComponentUI.update(Compiled Code)
at javax.swing.JComponent.paintComponent(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JViewport.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JSplitPane.paintChildren(JSplitPane.java:810)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:547)
at javax.swing.JComponent.paintChildren(Compiled Code)
at javax.swing.JComponent.paint(Compiled Code)
at java.awt.Container.paint(Compiled Code)
at sun.awt.windows.WComponentPeer.handleEvent(Compiled Code)
at java.awt.Component.dispatchEventImpl(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)
java -fullversion output: JAVA.EXE full version "JDK-1.2-V"
(Review ID: 55201)
======================================================================