View Javadoc

1   /*
2   
3   nextobjects Copyright (C) 2001-2005 Emmanuel Florent
4   
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by the
7   Free Software Foundation; either version 2 of the License, or (at your
8   option) any later version.
9   
10  This program is distributed in the hope that it will
11  be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12  of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the GNU General Public License for more details.
14  
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc., 59
17  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  
19  */
20  package org.devaki.nextobjects.ui.components;
21  import javax.swing.JTextArea;
22  /***
23   * This class overwrite the 'JTextarea' component.
24   */
25  public class CustomTextArea extends JTextArea
26  {
27      /***
28       * Construct a 'CustomTextArea' object
29       * @param text String to inialize the component with
30       * @param tooltipText Text that appears as a Tool Tips
31       * @param isEnabled Define if the component is enabled or not
32       * @param isEditable Define if the component is editable or not
33       */
34      public CustomTextArea(
35          final String text,
36          final String tooltipText,
37          final boolean isEnabled,
38          final boolean isEditable)
39      {
40          super(text);
41          // If the parameter 'tooltipText' is not empty, set it as tooltip
42          if (tooltipText.length() != 0)
43          {
44              this.setToolTipText(tooltipText);
45          }
46          // Enable/Disable
47          this.setEnabled(isEnabled);
48          // Set editable or not
49          this.setEditable(isEditable);
50          this.setLineWrap(true);
51          this.setWrapStyleWord(true);
52      }
53  }