KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > STextArea


1 /*
2  * $Id: STextArea.java,v 1.7 2005/04/08 15:36:08 blueshift Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings;
15
16 import org.wings.plaf.TextAreaCG;
17
18 /**
19  * @author <a HREF="mailto:armin.haaf@mercatis.de">Armin Haaf</a>
20  * @version $Revision: 1.7 $
21  */

22 public class STextArea extends STextComponent {
23
24     /**
25      * Text wrapping behaviour for {@link STextArea#setLineWrap(int)}: Don't wrap.
26      */

27     public final static int NO_WRAP = 0;
28     /**
29      * Text wrapping behaviour for {@link STextArea#setLineWrap(int)}: Wrap at width.
30      */

31     public final static int VIRTUAL_WRAP = 1;
32     /**
33      * Text wrapping behaviour for {@link STextArea#setLineWrap(int)}: Wrap at physical input box borders.
34      */

35     public final static int PHYSICAL_WRAP = 2;
36
37     private int rows = 5;
38
39     private int columns = 20;
40
41     /**
42      * allowed parameters
43      * are off(0), virtual(1), physical(2)
44      * default value is off
45      */

46     private int lineWrap = VIRTUAL_WRAP;
47
48
49     public STextArea(String JavaDoc text) {
50         super(text);
51     }
52
53
54     public STextArea() {
55         super();
56     }
57
58
59     public void setRows(int r) {
60         int oldRows = rows;
61         rows = r;
62         if (oldRows != rows)
63             reload();
64     }
65
66
67     public int getRows() {
68         return rows;
69     }
70
71
72     public void setColumns(int c) {
73         int oldColumns = columns;
74         columns = c;
75         if (columns != oldColumns)
76             reload();
77     }
78
79
80     public int getColumns() {
81         return columns;
82     }
83
84     /**
85      * Valid values are {@link #NO_WRAP} {@link #VIRTUAL_WRAP} and {@link #PHYSICAL_WRAP}
86      * @param lw
87      */

88     public void setLineWrap(int lw) {
89         if (lw >= 0 && lw < 3)
90             lineWrap = lw;
91     }
92
93
94     public int getLineWrap() {
95         return lineWrap;
96     }
97
98     public void setCG(TextAreaCG cg) {
99         super.setCG(cg);
100     }
101 }
102
103
104
Popular Tags