Name: ddT132432 Date: 11/06/2001
java version "1.4.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)
I submitted this bug months ago but did not receive a response, and I do not
see it listed so I will re-submit it.
Run the following code to see the bug:
--begin code--
import javax.swing.*;
import java.awt.*;
import javax.swing.text.*;
import java.awt.event.*;
class test{
JTextPane jtp;
test(){
run();
}
void run(){
JDialog jd=new JDialog();
Container c=jd.getContentPane();
c.setLayout(new BorderLayout(0,0));
jtp=new JTextPane();
Document d=jtp.getDocument();
try{
d.insertString(d.getLength(),"1\n2\n3\n4\n5\n6\n7\n8\n9\n10",null);
}
catch(Exception e){}
JMenuBar jmb=new JMenuBar();
JMenu jm=new JMenu("JMenu");
JMenuItem jmi=new JMenuItem("JMenuItem");
jm.add(jmi);
jmb.add(jm);
jmi.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
jtp.requestFocus();
jtp.setCaretPosition(8);
}
});
c.add(jmb,BorderLayout.NORTH);
c.add(jtp,BorderLayout.CENTER);
jd.pack();
jd.setSize(200,300);
jd.show();
}
public static void main(String[] args){
test t=new test();
}
}
--end code--
When run with JRE 1.4 beta (any beta), clicking on the "JMenuItem" button will
not set the text cursor correctly inside the JTextPane. When run with JRE
1.3.x, the program runs correctly - the text cursor is placed before the
number '5' when the JMenuItem button is clicked.
Release Regression From : merlin-rc1
The above release value was the last known release where this
bug was knwon to work. Since then there has been a regression.
(Review ID: 135131)
======================================================================