310 * @since 1.1
311 */
312 public void insert(String str, int pos) {
313 insertText(str, pos);
314 }
315
316 /**
317 * Inserts the specified text at the specified position
318 * in this text area.
319 *
320 * @param str the non-{@code null} text to insert
321 * @param pos the position at which to insert
322 * @deprecated As of JDK version 1.1,
323 * replaced by <code>insert(String, int)</code>.
324 */
325 @Deprecated
326 public synchronized void insertText(String str, int pos) {
327 TextAreaPeer peer = (TextAreaPeer)this.peer;
328 if (peer != null) {
329 peer.insert(str, pos);
330 } else {
331 text = text.substring(0, pos) + str + text.substring(pos);
332 }
333 }
334
335 /**
336 * Appends the given text to the text area's current text.
337 * <p>Note that passing <code>null</code> or inconsistent
338 * parameters is invalid and will result in unspecified
339 * behavior.
340 *
341 * @param str the non-<code>null</code> text to append
342 * @see java.awt.TextArea#insert
343 * @since 1.1
344 */
345 public void append(String str) {
346 appendText(str);
347 }
348
349 /**
350 * Appends the given text to the text area's current text.
351 *
352 * @param str the text to append
353 * @deprecated As of JDK version 1.1,
354 * replaced by <code>append(String)</code>.
355 */
356 @Deprecated
357 public synchronized void appendText(String str) {
358 if (peer != null) {
359 insertText(str, getText().length());
360 } else {
361 text = text + str;
362 }
363 }
364
365 /**
366 * Replaces text between the indicated start and end positions
367 * with the specified replacement text. The text at the end
368 * position will not be replaced. The text at the start
369 * position will be replaced (unless the start position is the
370 * same as the end position).
371 * The text position is zero-based. The inserted substring may be
372 * of a different length than the text it replaces.
373 * <p>Note that passing <code>null</code> or inconsistent
374 * parameters is invalid and will result in unspecified
375 * behavior.
376 *
377 * @param str the non-<code>null</code> text to use as
378 * the replacement
379 * @param start the start position
380 * @param end the end position
381 * @see java.awt.TextArea#insert
382 * @since 1.1
386 }
387
388 /**
389 * Replaces a range of characters between
390 * the indicated start and end positions
391 * with the specified replacement text (the text at the end
392 * position will not be replaced).
393 *
394 * @param str the non-{@code null} text to use as
395 * the replacement
396 * @param start the start position
397 * @param end the end position
398 * @deprecated As of JDK version 1.1,
399 * replaced by <code>replaceRange(String, int, int)</code>.
400 */
401 @Deprecated
402 public synchronized void replaceText(String str, int start, int end) {
403 TextAreaPeer peer = (TextAreaPeer)this.peer;
404 if (peer != null) {
405 peer.replaceRange(str, start, end);
406 } else {
407 text = text.substring(0, start) + str + text.substring(end);
408 }
409 }
410
411 /**
412 * Returns the number of rows in the text area.
413 * @return the number of rows in the text area
414 * @see #setRows(int)
415 * @see #getColumns()
416 * @since 1.0
417 */
418 public int getRows() {
419 return rows;
420 }
421
422 /**
423 * Sets the number of rows for this text area.
424 * @param rows the number of rows
425 * @see #getRows()
426 * @see #setColumns(int)
427 * @exception IllegalArgumentException if the value
428 * supplied for <code>rows</code>
|
310 * @since 1.1
311 */
312 public void insert(String str, int pos) {
313 insertText(str, pos);
314 }
315
316 /**
317 * Inserts the specified text at the specified position
318 * in this text area.
319 *
320 * @param str the non-{@code null} text to insert
321 * @param pos the position at which to insert
322 * @deprecated As of JDK version 1.1,
323 * replaced by <code>insert(String, int)</code>.
324 */
325 @Deprecated
326 public synchronized void insertText(String str, int pos) {
327 TextAreaPeer peer = (TextAreaPeer)this.peer;
328 if (peer != null) {
329 peer.insert(str, pos);
330 }
331 text = text.substring(0, pos) + str + text.substring(pos);
332 }
333
334 /**
335 * Appends the given text to the text area's current text.
336 * <p>Note that passing <code>null</code> or inconsistent
337 * parameters is invalid and will result in unspecified
338 * behavior.
339 *
340 * @param str the non-<code>null</code> text to append
341 * @see java.awt.TextArea#insert
342 * @since 1.1
343 */
344 public void append(String str) {
345 appendText(str);
346 }
347
348 /**
349 * Appends the given text to the text area's current text.
350 *
351 * @param str the text to append
352 * @deprecated As of JDK version 1.1,
353 * replaced by <code>append(String)</code>.
354 */
355 @Deprecated
356 public synchronized void appendText(String str) {
357 insertText(str, getText().length());
358 }
359
360 /**
361 * Replaces text between the indicated start and end positions
362 * with the specified replacement text. The text at the end
363 * position will not be replaced. The text at the start
364 * position will be replaced (unless the start position is the
365 * same as the end position).
366 * The text position is zero-based. The inserted substring may be
367 * of a different length than the text it replaces.
368 * <p>Note that passing <code>null</code> or inconsistent
369 * parameters is invalid and will result in unspecified
370 * behavior.
371 *
372 * @param str the non-<code>null</code> text to use as
373 * the replacement
374 * @param start the start position
375 * @param end the end position
376 * @see java.awt.TextArea#insert
377 * @since 1.1
381 }
382
383 /**
384 * Replaces a range of characters between
385 * the indicated start and end positions
386 * with the specified replacement text (the text at the end
387 * position will not be replaced).
388 *
389 * @param str the non-{@code null} text to use as
390 * the replacement
391 * @param start the start position
392 * @param end the end position
393 * @deprecated As of JDK version 1.1,
394 * replaced by <code>replaceRange(String, int, int)</code>.
395 */
396 @Deprecated
397 public synchronized void replaceText(String str, int start, int end) {
398 TextAreaPeer peer = (TextAreaPeer)this.peer;
399 if (peer != null) {
400 peer.replaceRange(str, start, end);
401 }
402 text = text.substring(0, start) + str + text.substring(end);
403 }
404
405 /**
406 * Returns the number of rows in the text area.
407 * @return the number of rows in the text area
408 * @see #setRows(int)
409 * @see #getColumns()
410 * @since 1.0
411 */
412 public int getRows() {
413 return rows;
414 }
415
416 /**
417 * Sets the number of rows for this text area.
418 * @param rows the number of rows
419 * @see #getRows()
420 * @see #setColumns(int)
421 * @exception IllegalArgumentException if the value
422 * supplied for <code>rows</code>
|