JDK-4519711 : Text is echoed at the top of a JTextPane inside a JScrollPane in a JnternalFrame
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-10-26
  • Updated: 2002-09-05
  • Resolved: 2002-09-05
Related Reports
Duplicate :  
Relates :  
Description

Name: ddT132432			Date: 10/25/2001


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

Odd behavior is experinced when running a JInternalFrame. 

Run the following program:
--begin code--

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

class test{

  test(){
    run();
  }
  
  void run(){
    //Create the JFrame with a JDesktopPane
    JFrame jf=new JFrame();
    JDesktopPane jdp=new JDesktopPane();
    Rectangle rec=new Rectangle(800,500);
    jf.getContentPane().add(jdp);
    jf.setLocation(0,0);
    jf.setBounds(rec);
    jf.setVisible(true);
    //Create the JInternalFrame, add a JTextPane to it, and
    //add the JInternalFrame to the JFrame
    JInternalFrame jif=new JInternalFrame("test",true,true,true);
    JTextPane jtp=new JTextPane();
    JScrollPane jsp=new JScrollPane(jtp);
    jif.getContentPane().add(jsp);
    jif.setBounds(new Rectangle(0,0,600,400));
    jdp.add(jif);
    Document d=jtp.getDocument();
    try{
      d.insertString(0,"\n\n\n\n\n\n\n\n\n\nhello world",null);
    }
    catch(Exception e){}
    jif.setVisible(true);
  }
  
  public static void main(String[] args){
    test t=new test();
  }
  
}

--end code--

When you click on the JInternalFrame icon to maximize the frame, you will
notice that "hello world" has been echoed in the top of the JTextPane - which
shouldn't happen. This only seems to happen when text is inserted into the
JTextPane when the JInternalFrame is initially invisible. This is probably a
bug inside the JScrollPane class since adding a JTextPane to the JInternalFrame
without a JScrollPane does not cause the problem.
(Review ID: 134387) 
======================================================================

Comments
EVALUATION Name: dsR10138 Date: 09/05/2002 This bug exists due to the same reason as bug 4624515 which is fixed now. So I'm closing it as a duplicate of 4624515. ###@###.### 2002-09-05 ======================================================================
05-09-2002