summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/awt/TextArea.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-14 23:12:35 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-14 23:12:35 +0000
commitffde862e033a0825e1e9972a89c0f1f80b261a8e (patch)
tree97037d2c09c8384d80531f67ec36a01205df6bdb /libjava/classpath/java/awt/TextArea.java
parentb415ff10527e977c3758234fd930e2c027bfa17d (diff)
downloadgcc-ffde862e033a0825e1e9972a89c0f1f80b261a8e.tar.gz
2006-08-14 Mark Wielaard <mark@klomp.org>
Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/awt/TextArea.java')
-rw-r--r--libjava/classpath/java/awt/TextArea.java64
1 files changed, 45 insertions, 19 deletions
diff --git a/libjava/classpath/java/awt/TextArea.java b/libjava/classpath/java/awt/TextArea.java
index b04cdc89204..7e3463ab849 100644
--- a/libjava/classpath/java/awt/TextArea.java
+++ b/libjava/classpath/java/awt/TextArea.java
@@ -125,9 +125,11 @@ public class TextArea extends TextComponent implements java.io.Serializable
* the specified text. Conceptually the <code>TextArea</code> has 0
* rows and 0 columns but its initial bounds are defined by its peer
* or by the container in which it is packed. Both horizontal and
- * veritcal scrollbars will be displayed.
+ * veritcal scrollbars will be displayed. The TextArea initially contains
+ * the specified text. If text specified as <code>null<code>, it will
+ * be set to "".
*
- * @param text The text to display in this text area.
+ * @param text The text to display in this text area (<code>null</code> permitted).
*
* @exception HeadlessException if GraphicsEnvironment.isHeadless () is true
*/
@@ -156,9 +158,10 @@ public class TextArea extends TextComponent implements java.io.Serializable
* Initialize a new instance of <code>TextArea</code> that can
* display the specified number of rows and columns of text, without
* the need to scroll. The TextArea initially contains the
- * specified text.
+ * specified text. If text specified as <code>null<code>, it will
+ * be set to "".
*
- * @param text The text to display in this text area.
+ * @param text The text to display in this text area (<code>null</code> permitted).
* @param rows The number of rows in this text area.
* @param columns The number of columns in this text area.
*
@@ -174,9 +177,10 @@ public class TextArea extends TextComponent implements java.io.Serializable
* contains the specified text. The TextArea can display the
* specified number of rows and columns of text, without the need to
* scroll. This constructor allows specification of the scroll bar
- * display policy.
+ * display policy. The TextArea initially contains the specified text.
+ * If text specified as <code>null<code>, it will be set to "".
*
- * @param text The text to display in this text area.
+ * @param text The text to display in this text area (<code>null</code> permitted).
* @param rows The number of rows in this text area.
* @param columns The number of columns in this text area.
* @param scrollbarVisibility The scroll bar display policy. One of
@@ -192,18 +196,20 @@ public class TextArea extends TextComponent implements java.io.Serializable
if (GraphicsEnvironment.isHeadless ())
throw new HeadlessException ();
- if (rows < 0 || columns < 0)
- throw new IllegalArgumentException ("Bad row or column value");
-
- if (scrollbarVisibility != SCROLLBARS_BOTH
- && scrollbarVisibility != SCROLLBARS_VERTICAL_ONLY
- && scrollbarVisibility != SCROLLBARS_HORIZONTAL_ONLY
- && scrollbarVisibility != SCROLLBARS_NONE)
- throw new IllegalArgumentException ("Bad scrollbar visibility value");
+ if (rows < 0)
+ this.rows = 0;
+ else
+ this.rows = rows;
+
+ if (columns < 0)
+ this.columns = 0;
+ else
+ this.columns = columns;
- this.rows = rows;
- this.columns = columns;
- this.scrollbarVisibility = scrollbarVisibility;
+ if (scrollbarVisibility < 0 || scrollbarVisibility > 4)
+ this.scrollbarVisibility = SCROLLBARS_BOTH;
+ else
+ this.scrollbarVisibility = scrollbarVisibility;
// TextAreas need to receive tab key events so we override the
// default forward and backward traversal key sets.
@@ -478,6 +484,8 @@ public class TextArea extends TextComponent implements java.io.Serializable
if (peer != null)
peer.insert (str, peer.getText().length ());
+ else
+ setText(getText() + str);
}
/**
@@ -504,10 +512,19 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public void insertText (String str, int pos)
{
+ String tmp1 = null;
+ String tmp2 = null;
+
TextAreaPeer peer = (TextAreaPeer) getPeer ();
if (peer != null)
peer.insert (str, pos);
+ else
+ {
+ tmp1 = getText().substring(0, pos);
+ tmp2 = getText().substring(pos, getText().length());
+ setText(tmp1 + str + tmp2);
+ }
}
/**
@@ -544,10 +561,19 @@ public class TextArea extends TextComponent implements java.io.Serializable
*/
public void replaceText (String str, int start, int end)
{
- TextAreaPeer peer = (TextAreaPeer) getPeer ();
+ String tmp1 = null;
+ String tmp2 = null;
+
+ TextAreaPeer peer = (TextAreaPeer) getPeer();
if (peer != null)
- peer.replaceRange (str, start, end);
+ peer.replaceRange(str, start, end);
+ else
+ {
+ tmp1 = getText().substring(0, start);
+ tmp2 = getText().substring(end, getText().length());
+ setText(tmp1 + str + tmp2);
+ }
}
/**