[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-cp] [bug #13260] swing: JTextArea.setText("") causes StringIndex
From: |
Timo Lindfors |
Subject: |
[commit-cp] [bug #13260] swing: JTextArea.setText("") causes StringIndexOutOfBoundsException later |
Date: |
Wed, 1 Jun 2005 17:13:27 +0000 |
User-agent: |
Elinks |
URL:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=13260>
Summary: swing: JTextArea.setText("") causes
StringIndexOutOfBoundsException later
Project: classpath
Submitted by: lindi
Submitted on: Wed 06/01/05 at 17:13
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 an empty 10x40 textara.
Actual results:
1. No window is shown and program throws the following exception:
java.lang.StringIndexOutOfBoundsException
at java.lang.String.<init> (String.java:512)
at java.lang.String.<init> (String.java:237)
at gnu.java.awt.peer.gtk.GdkFontMetrics.charsWidth
(GdkFontMetrics.java:97)
at javax.swing.text.PlainView.getPreferredSpan (PlainView.java:228)
at javax.swing.plaf.basic.BasicTextUI$RootView.getPreferredSpan
(BasicTextUI.java:136)
at javax.swing.plaf.basic.BasicTextUI.getPreferredSize
(BasicTextUI.java:464)
at javax.swing.JComponent.getPreferredSize (JComponent.java:1032)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize
(JRootPane.java:278)
at java.awt.Container.preferredSize (Container.java:626)
at java.awt.Container.getPreferredSize (Container.java:613)
at javax.swing.JComponent.getPreferredSize (JComponent.java:1036)
at java.awt.BorderLayout.calcCompSize (BorderLayout.java:655)
at java.awt.BorderLayout.calcSize (BorderLayout.java:700)
at java.awt.BorderLayout.preferredLayoutSize (BorderLayout.java:454)
at java.awt.Container.preferredSize (Container.java:626)
at java.awt.Container.getPreferredSize (Container.java:613)
at javax.swing.JFrame.getPreferredSize (JFrame.java:91)
at java.awt.Window.pack (Window.java:267)
at textarea.<init> (textarea.java:11)
at textarea.main (textarea.java:4)
Testcase:
import javax.swing.*;
public class textarea extends JFrame {
public static void main(String[] a) {
(new textarea()).show();
}
public textarea() {
JTextArea textarea = new JTextArea(10, 40);
textarea.setText("text0\n");
textarea.setText("");
this.setContentPane(textarea);
this.pack();
}
}
Note that this is very similar to bug 13230.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=13260>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [commit-cp] [bug #13260] swing: JTextArea.setText("") causes StringIndexOutOfBoundsException later,
Timo Lindfors <=