BlackBerry在Field外单击(BlackBerry click outside Field)
我正在为支持触摸的设备实现自定义ImageButton(9500,9550,9800,...)我有问题,点击(触摸)外部字段在聚焦字段中生成事件。(当扩展
Field
,BitmapField
)我可以通过将焦点移动到空场来解决它,但这不是很好。 奇怪的是,这种行为适用于
Field
,BitmapField
但不适用于ButtonField
。 看起来,当ButtonField
聚焦时,外部点击不会生成按钮事件。我尝试扩展
ButtonField
,但我无法摆脱那个愚蠢的Button Background。所以我的问题;
Field
和ButtonField
之间的行为有什么不同导致在Field
外生成事件?这是我删除按钮背景的方式:
// cahange button border setBorder(BorderFactory .createSimpleBorder(new XYEdges(0, 0, 0, 0))); setBorder(VISUAL_STATE_ACTIVE, BorderFactory .createSimpleBorder(new XYEdges(0, 0, 0, 0)));
I'm implementing a custom ImageButton for touch enabled devices (9500,9550,9800,...) I have problem that click(touch) outside field generates event in focused field.(when extending
Field
,BitmapField
)I can solve it by moving focus to empty field, but this is not very nice. Strange thing is that this behaviour is for
Field
,BitmapField
but not forButtonField
. It realy seems that when isButtonField
focused, outside clicks don't generates button event.I tryed extending
ButtonField
, but I couldn't get rid of that stupid Button Background.So my question; what is that difference in behavior between
Field
andButtonField
that causes generating events outsideField
?this is how I removed button background:
// cahange button border setBorder(BorderFactory .createSimpleBorder(new XYEdges(0, 0, 0, 0))); setBorder(VISUAL_STATE_ACTIVE, BorderFactory .createSimpleBorder(new XYEdges(0, 0, 0, 0)));
原文:https://stackoverflow.com/questions/5948222
最满意答案
在正则表达式中,'{','['等等是特殊字符,需要进行转义,所以你应该使用
\{
来表达{
,所以你的refex表达式是错误的,所以抛出这样的异常。
实际上我不建议你使用正则表达式来搜索你的情况,你最好解析一个jsonarray并检查每个jsonobject的名字。In regex expression,'{','[' and so on are special character and need to be escaped,so you should use
\{
to express{
,so your refex expression is wrong so such a exception throws.
Actually I don't suggest you use regex experssion to search in your situation,you'd better parse a jsonarray and check every jsonobject's name.
相关问答
更多-
Android上的java.util.regex.PatternSyntaxException(java.util.regex.PatternSyntaxException on Android)[2023-06-16]
这个android / java正则表达式页面表明支持反向视图,并且你有正确的语法。 我没有看到如何逃避{可能导致正则表达式的问题。 你是否尝试过这种表达形式? string ex = "(?<=\\}),(?=\\{)"; This android/java regex page indicates that lookbehinds are supported and that you have the correct syntax for it. I don't see how escaping the ... -
使用: Pattern.compile( “^ 08 [3-9] - ([0-9]){7} $”); 甚至 Pattern.compile( “08 [3-9] - ([0-9]){7}”); Use: Pattern.compile("^08[3-9]-([0-9]){7}$"); or even Pattern.compile("08[3-9]-([0-9]){7}");
-
实际上,我错过了为文件web.xml包含xmlproperty。
将上面的代码行添加到我的build.xml中后,这个工作正常。 Actually, I was missing to include xmlproperty for file web.xml. After addi ... -
您需要转义在正则表达式中具有特殊含义的所有字符。 listMainString = inputLine.split("\\}\\]\\},"); You need to escape all characters that have special meaning in regular expressions. listMainString = inputLine.split("\\}\\]\\},");
-
缺少全局标志g以获得整套匹配。 var text = "#hello some text #Home"; var myRegExp = new RegExp("[#]+[A-Za-z0-9-_]+\\b", "g"); var tagMatcher = text.match(myRegExp); console.log(tagMatcher) 就像@JordanRunning提到的那样,你可以使用Regex文字如下,以及更短的方法: var text = "#hello some text #Ho ...
-
Jakarta Regexp和Java 6 java.util.regex之间的区别(Differences between Jakarta Regexp and Java 6 java.util.regex)[2022-03-06]
java.util.regex.Matcher.matches()方法将尝试将完整的输入字符串与正则表达式匹配,这将是false 。 如果要在输入字符串中搜索模式,则需要使用java.util.regex.Matcher.find()方法: result = matcher.find(); // returns true The java.util.regex.Matcher.matches() method will try to match the complete input string aga ... -
Android - Java Regex - 索引附近的regexp模式中的语法错误(Android - Java Regex - Syntax error in regexp pattern near index)[2023-01-30]
在正则表达式中,'{','['等等是特殊字符,需要进行转义,所以你应该使用\{来表达{ ,所以你的refex表达式是错误的,所以抛出这样的异常。 实际上我不建议你使用正则表达式来搜索你的情况,你最好解析一个jsonarray并检查每个jsonobject的名字。 In regex expression,'{','[' and so on are special character and need to be escaped,so you should use \{ to express {,so your ... -
您可以为模式添加|(.)替代(以匹配除了换行符之外的任何char)并检查每个匹配组是否匹配。 如果是,则输出false ,否则输出true : String argument = "#a1^b2"; Pattern pattern = Pattern.compile("[a-zA-Z]|[0-9]|\\s|(.)"); // or "[a-zA-Z0-9\\s]|(.)" Matcher matcher = pattern.matcher(argument); while(matcher.find()) ...
-
android中的regex的firstname和lastname验证器[关闭](firstname and lastname validator by regex in android [closed])[2022-10-11]
java.util.regex.PatternSyntaxException意味着您的正则表达式不正确。 看起来你正试图看看名字中是否有任何非法字符。 这样做更容易: Pattern pattern = Pattern.compile("[^a-zA-Z]"); Matcher matcher = pattern.matcher(txt); return matcher.find(); 这匹配任何非ALPHABET而不是所有的胡言乱语。 希望这可以帮助! 编辑:由于OP的要求,这里应该是它的样子(读者,如 ... -
错误:模式必须是RegExp(Error: pattern must be a RegExp)[2021-12-11]
实际上,正如这里所记载的那样(链接) , Joi框架在这里不是一个正则表达式模式 ,而是一个真正的正则表达式 。 即:,你应该使用: Joi.string().required().regex(/^[0-9]*$/) [...] ... 代替: Joi.string().required().regex('^[0-9]*$') [...] Actually, as documented here (link) the Joi framework expects here not a regex patt ...