-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.6, 1.1.7
-
generic, sparc
-
generic, solaris_2.6
Name: clC74495 Date: 04/07/99
Using Swing 1.1.1-beta[1 or 2]...
adding text using setText("...") method of a JEditorPane
enclosed within a JScollPane automatically scrolls the pane
to the bottom. This behaviour is new to 1.1.1 and undesirable
in this case. I can find no way to deactivate it.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame
{
private JButton button = new JButton( "Click Me!" );
private String text =
"Mary had a little lamb,\n" +
"Its fleece was white as snow\n" +
"And everywhere that Mary went\n" +
"The lamb was sure to go.\n\n" +
"Baa Baa Black Sheep,\n" +
"Have you any wool?\n" +
"Yes sir, yes sir,\n" +
"Three bags full";
public Test()
{
super( "Test" );
final JEditorPane editor = new JEditorPane();
getContentPane().add( new JScrollPane( editor ), BorderLayout.CENTER );
getContentPane().add( button, BorderLayout.SOUTH );
button.addActionListener( new ActionListener()
{
public void actionPerformed( ActionEvent evt )
{
editor.setText( text );
}
} );
pack();
setSize( 300, 150 );
show();
editor.setText( text );
}
public static void main( String[] args )
{
new Test();
}
}
(Review ID: 56576)
======================================================================
- duplicates
-
JDK-4242632 JScrollPane & its RowHeader do not stay in sync
-
- Closed
-