commit-classpath
[Top][All Lists]
Advanced

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

[commit-cp] [bug #13230] swing: JTextArea.setText() fails with multiple


From: Timo Lindfors
Subject: [commit-cp] [bug #13230] swing: JTextArea.setText() fails with multiple lines of text
Date: Mon, 30 May 2005 15:12:56 +0000
User-agent: Elinks

URL:
  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13230>

                 Summary: swing: JTextArea.setText() fails with multiple
lines of text
                 Project: classpath
            Submitted by: lindi
            Submitted on: Mon 05/30/05 at 15:12
                Category: classpath
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
        Platform Version: None

    _______________________________________________________

Details:

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\n");
                textarea.setText("text1\n");
                this.setContentPane(textarea);
                this.pack();
        }
}


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






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?func=detailitem&item_id=13230>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

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