-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathTextComponent.java
More file actions
executable file
·49 lines (47 loc) · 1.06 KB
/
Copy pathTextComponent.java
File metadata and controls
executable file
·49 lines (47 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package javaforce.webui;
/** Text Component
*
* @author pquiring
*/
public abstract class TextComponent extends Container {
protected String text;
public abstract void update();
public void setText(String text) {
this.text = text;
update();
onChanged(new String[] {"text=" + text});
}
public String getText() {
return text;
}
public String destringify(String in) {
char[] ca = in.toCharArray();
StringBuilder sb = new StringBuilder();
for(int a=0;a<ca.length;a++) {
char ch = ca[a];
switch (ch) {
case '\\': {
switch (ca[++a]) {
case '\\': {
sb.append(ch);
break;
}
case 't': {
sb.append("\t");
break;
}
case 'n': {
sb.append(System.lineSeparator());
break;
}
}
break;
}
default:
sb.append(ch);
break;
}
}
return sb.toString();
}
}