forked from pquiring/javaforce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextField.java
More file actions
executable file
·33 lines (31 loc) · 857 Bytes
/
Copy pathTextField.java
File metadata and controls
executable file
·33 lines (31 loc) · 857 Bytes
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
package javaforce.webui;
/** TextField
*
* @author pquiring
*/
public class TextField extends TextComponent {
public boolean password;
public TextField(String text) {
this.text = text;
addEvent("onchange", "onTextChange(event, this);");
addEvent("onkeyup", "onTextChange(event, this);");
setClass("textfield");
}
public String html() {
return "<input" + getAttrs() + " value='" + text + "'>";
}
public void updateText(String txt) {
sendEvent("setvalue", new String[] {"value=" + text});
}
public void setPassword(boolean state) {
if (state)
addAttr("type", "password");
else
removeAttr("type");
}
public void onChanged(String[] args) {
int idx = args[0].indexOf("=");
text = destringify(args[0].substring(idx+1));
super.onChanged(args);
}
}