bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22960] swing: JTextArea.setText() fails with multiple lin


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22960] swing: JTextArea.setText() fails with multiple lines of text
Date: 16 Oct 2005 01:27:47 -0000

Steps to reproduce:
1. Compile and run the attached testcase.

Expected results:
1. A window shows up. It has a textarea with "text1".

Actual results:
1. No window is shown and the testcase throws the following exception:
java.lang.NegativeArraySizeException
   at javax.swing.text.AbstractDocument$BranchElement.replace
(AbstractDocument.java:747)
   at javax.swing.text.PlainDocument.removeUpdate (PlainDocument.java:136)
   at javax.swing.text.AbstractDocument.remove (AbstractDocument.java:294)
   at javax.swing.text.JTextComponent.setText (JTextComponent.java:1016)
   at textarea.<init> (textarea.java:9)
   at textarea.main (textarea.java:4)


Testcase:
import javax.swing.*;
public class textarea extends JFrame {
        public static void main(String[] args) {
                (new textarea()).show();
                }
        public textarea() {
                JTextArea textarea = new JTextArea(10, 40);
                textarea.setText("text0
");
                textarea.setText("text1
");
                this.setContentPane(textarea);
                this.pack();
        }
}


Note that "text0" works but "text0
" (with newline) does not.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-06-01 
10:04 -------
I checked in a fix for that too. Please check and close if it works.


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-06-01 
11:21 -------
Seems to work now.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22960





reply via email to

[Prev in Thread] Current Thread [Next in Thread]