本文整理汇总了Java中javax.microedition.lcdui.TextField.DECIMAL属性的典型用法代码示例。如果您正苦于以下问题:Java TextField.DECIMAL属性的具体用法?Java TextField.DECIMAL怎么用?Java TextField.DECIMAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.microedition.lcdui.TextField
的用法示例。
在下文中一共展示了TextField.DECIMAL属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isValidString
/**
* Check is this is a valid string given the constraints
*
* @param dca string to check
* @param constraints the constraints
* @return true if this is a valid string
*/
public static boolean isValidString(DynamicCharacterArray dca,
int constraints) {
if (dca.length() == 0) {
return true;
}
switch (constraints & TextField.CONSTRAINT_MASK) {
case TextField.ANY: return true;
case TextField.DECIMAL: return checkDecimal(dca.toString());
case TextField.EMAILADDR: return true;
case TextField.NUMERIC: return checkNumeric(dca.toString());
case TextField.PHONENUMBER: return checkPhoneNumber(dca.toString());
case TextField.URL: return true;
}
return false;
}
示例2: setInputMethodListener
public void setInputMethodListener(InputMethodListener l)
{
inputMethodListener = l;
switch (l.getConstraints() & TextField.CONSTRAINT_MASK) {
case TextField.ANY :
case TextField.EMAILADDR :
case TextField.URL :
setInputMode(INPUT_ABC_LOWER);
break;
case TextField.NUMERIC :
case TextField.PHONENUMBER :
case TextField.DECIMAL :
setInputMode(INPUT_123);
break;
}
}
示例3: GeoPointWidget
public GeoPointWidget() {
//#style leftlabeledTextField
tfLat = new TextField(Localization.get("activity.locationcapture.Latitude")+":", "", 20, TextField.DECIMAL);
//#style leftlabeledTextField
tfLon = new TextField(Localization.get("activity.locationcapture.Longitude")+":", "", 20, TextField.DECIMAL);
//#style leftlabeledTextField
tfAlt = new TextField(Localization.get("activity.locationcapture.Altitude")+"(m):", "", 20, TextField.DECIMAL);
//#style leftlabeledTextField
tfAcc = new TextField(Localization.get("activity.locationcapture.Accuracy")+"(m):", "", 20, TextField.DECIMAL);
}
示例4: filterConstraints
protected char[] filterConstraints(char[] chars) {
char[] result = new char[chars.length];
int i, j;
for (i = 0, j = 0; i < chars.length; i++) {
switch (inputMethodListener.getConstraints() & TextField.CONSTRAINT_MASK) {
case TextField.ANY :
result[j] = chars[i];
j++;
break;
case TextField.EMAILADDR :
// TODO
break;
case TextField.NUMERIC :
if (Character.isDigit(chars[i]) || chars[i] == '-') {
result[j] = chars[i];
j++;
}
break;
case TextField.PHONENUMBER :
// TODO
break;
case TextField.URL :
if (chars[i] != '\n') {
result[j] = chars[i];
j++;
}
break;
case TextField.DECIMAL :
if (Character.isDigit(chars[i]) || chars[i] == '-' || chars[i] == '.') {
result[j] = chars[i];
j++;
}
break;
}
}
if (i != j) {
char[] newresult = new char[j];
System.arraycopy(result, 0, newresult, 0, j);
result = newresult;
}
return result;
}
示例5: NumberInput
/**
* Creates a new instance of NumberInput
* @param caption
* @param max
* @param min
* @param text
*/
public NumberInput(String caption, String text, int min, int max) {
super(caption, text, null, (min<0)?TextField.DECIMAL:TextField.NUMERIC);
this.min=min;
this.max=max;
initValue=text;
}