001    /* 
002     * Copyright (c) Holger Pfaff - http://pfaff.ws
003     *
004     * This software maybe used for any purpose provided the
005     * above copyright notice is retained. It is supplied as is.
006     * No warranty expressed or implied - Use at your own risk.
007     */
008    
009    import java.awt.TextArea;
010    
011    /**
012      * (#)EditField.java
013      * @author   Holger Pfaff
014      * @version  3.2 19-Mar-2004<br><br> 
015      *
016      * A wrapper around (AWT) TextArea to overcome some shortcomings
017      *
018      */
019    
020    public class EditArea extends AwtText {
021      
022      /**
023       *  Constructor with size spec
024       */
025      public EditArea(int rows,int cols) {
026        this("", rows, cols);
027      }
028    
029      /**
030       *  Constructor with string init & size spec
031       */
032      public EditArea(String text, int rows,int cols) {
033        this(text, rows, cols, TextArea.SCROLLBARS_BOTH);
034      }
035        
036      /**
037       *  Constructor with string init & size spec & scrollbar spec
038       */
039      public EditArea(String text, int rows, int cols, int sb) {
040        textcomp = new TextArea(text, rows, cols, sb);
041        add(textcomp);
042      }
043    
044      /**
045       *  Return the wrapped comp
046             *
047             * @return warpped TextArea
048       */
049      public TextArea getTextArea() {
050        return (TextArea) textcomp;
051      }
052            
053      /**
054       * implement TextArea.append()
055       */
056            public void append(String str) {
057        getTextArea().append(str);
058            }
059              
060      /**
061       * implement TextArea.insert()
062       */
063      public void insert(String str, int pos) {
064        getTextArea().insert(str, pos);
065            }
066            
067      /**
068       * implement TextArea.replaceRange()
069       */
070      public void replaceRange(String str, int start, int end) {
071        getTextArea().replaceRange(str, start, end);
072            }
073              
074      /**
075       * implement TextArea.getRows()
076       */
077            public int getRows() {
078        return getTextArea().getRows();
079      }
080      
081      /**
082       * implement TextArea.setRows()
083       */
084      public void setRows(int rows) {
085        getTextArea().setRows(rows);
086      }
087    
088      /**
089       * implement TextArea.getColumns()
090       */
091      public int getColumns() {
092        return getTextArea().getColumns();
093      }
094      
095      /**
096       * implement TextArea.setColumns()
097       */
098      public void setColumns(int columns) {
099        getTextArea().setColumns(columns);
100      }
101    }