-
Bug
-
Resolution: Fixed
-
P3
-
1.1.2, 1.1.3
-
None
-
1.1.5
-
sparc
-
solaris_2.5
Call JTextArea.append(String) then enlarge the window in south direction cause "java.lang.IllegalArgumentException: inconsistent values" and the scoll bars becomes misplaced. This bug only show on Solaris. It works fine on Win32.
To reproduce this bug, please run the following code. Push "start" button then resize the window in south direction.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class myTest extends JPanel
{
JTextArea tArea ;
public static void main(String[] args){
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
};
JFrame f = new JFrame();
f.addWindowListener(l);
f.add( new myTest());
f.pack();
f.show();
}
myTest() {
// Create GUI components
JButton startButton = new JButton("Start");
JButton clearButton = new JButton("Clear");
tArea = new JTextArea();
// Add Listener
startButton.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
byte[] ba = new byte[2];
FileInputStream ff = new FileInputStream("myTest.java");
while ( ff.read(ba) != -1 ) {
tArea.append(new String(ba) );
}
}catch ( Exception ee ) {
ee.printStackTrace();
}
}
});
clearButton.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
tArea.setText("");
}
});
// layout
this.setLayout(new BorderLayout());
this.add("North", startButton);
this.add("Center", tArea);
this.add("South",clearButton);
}
}
To reproduce this bug, please run the following code. Push "start" button then resize the window in south direction.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class myTest extends JPanel
{
JTextArea tArea ;
public static void main(String[] args){
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
};
JFrame f = new JFrame();
f.addWindowListener(l);
f.add( new myTest());
f.pack();
f.show();
}
myTest() {
// Create GUI components
JButton startButton = new JButton("Start");
JButton clearButton = new JButton("Clear");
tArea = new JTextArea();
// Add Listener
startButton.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
byte[] ba = new byte[2];
FileInputStream ff = new FileInputStream("myTest.java");
while ( ff.read(ba) != -1 ) {
tArea.append(new String(ba) );
}
}catch ( Exception ee ) {
ee.printStackTrace();
}
}
});
clearButton.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
tArea.setText("");
}
});
// layout
this.setLayout(new BorderLayout());
this.add("North", startButton);
this.add("Center", tArea);
this.add("South",clearButton);
}
}
- duplicates
-
JDK-4060026 JTextArea.setText( String) causes IllegalArgumentException on Solaris
-
- Closed
-