1 /* Copyright (C) 1999 Cygnus Solutions
3 This file is part of libjava.
5 This software is copyrighted work licensed under the terms of the
6 Libjava License. Please consult the file "LIBJAVA_LICENSE" for
11 /* A very incomplete placeholder. */
13 public class TextArea extends TextComponent
15 public synchronized void append (String str)
17 replaceRange(str, length, length);
20 public synchronized void insert (String str, int pos)
22 replaceRange(str, pos, pos);
25 public synchronized void replaceRange (String str, int start, int end)
31 int len = str.length();
32 int delta = len - (end - start);
33 int new_length = length + delta;
34 if (buffer.length < new_length)
36 int new_size = 2 * buffer.length;
37 if (new_size < new_length)
38 new_size = new_length;
39 char[] new_buffer = new char[new_size];
40 System.arraycopy(buffer, 0, new_buffer, 0, length);
44 System.arraycopy(buffer, start, buffer, start + len, len - end);
45 str.getChars(0, len, buffer, start);