Ejemplo n.º 1
0
  /**
   * Returns the preferred size of a text field with the specified number of rows and columns.
   *
   * @param rows The number of rows to get the preferred size for.
   * @param columns The number of columns to get the preferred size for.
   */
  public Dimension getPreferredSize(int rows, int columns) {
    TextAreaPeer tap = (TextAreaPeer) getPeer();
    if (tap == null) {
      // Sun's JDK just seems to return Dimension(0,0) in this case.
      // we do the same.
      return new Dimension(0, 0);
    }

    return (tap.getPreferredSize(rows, columns));
  }
Ejemplo n.º 2
0
  /**
   * Replaces the text bounded by the specified start and end positions with the specified text.
   *
   * @param text The new text for the range.
   * @param start The start position of the replacement range.
   * @param end The end position of the replacement range.
   */
  public void replaceRange(String text, int start, int end) {
    TextAreaPeer tap = (TextAreaPeer) getPeer();
    if (tap == null) return;

    tap.replaceRange(text, start, end);
  }
Ejemplo n.º 3
0
  /**
   * Inserts the specified text at the specified location.
   *
   * @param text The text to insert.
   * @param pos The insert position.
   */
  public void insert(String text, int pos) {
    TextAreaPeer tap = (TextAreaPeer) getPeer();
    if (tap == null) return;

    tap.insert(text, pos);
  }
Ejemplo n.º 4
0
  /**
   * Appends the specified text to the end of the current text.
   *
   * @param text The text to append.
   */
  public void append(String str) {
    TextAreaPeer tap = (TextAreaPeer) getPeer();
    if (tap == null) return;

    tap.insert(str, tap.getText().length());
  }
Ejemplo n.º 5
0
  /**
   * Returns the minimum size of a text field with the specified number of rows and columns.
   *
   * @param rows The number of rows to get the minimum size for.
   * @param columns The number of columns to get the minimum size for.
   */
  public Dimension getMinimumSize(int rows, int columns) {
    TextAreaPeer tap = (TextAreaPeer) getPeer();
    if (tap == null) return (null); // FIXME: What do we do if there is no peer?

    return (tap.getMinimumSize(rows, columns));
  }