Java me 在j2me中显示错误后,如何将焦点放在文本字段上?
我正在验证大量数据。。所以,在向用户展示他并没有填写某些特定的细节之后,我想把重点放在它上。。。。所以有人会提供一些解决方案Java me 在j2me中显示错误后,如何将焦点放在文本字段上?,java-me,Java Me,我正在验证大量数据。。所以,在向用户展示他并没有填写某些特定的细节之后,我想把重点放在它上。。。。所以有人会提供一些解决方案 正如我可以将重点放在其他页面上。您可以使用callSerially方法Display对象avec类实现Runnable void getThisAlert(String Title, Displayable txtagency2) { Alert error = new Alert("", Title, null, AlertType.INFO); er
正如我可以将重点放在其他页面上。您可以使用
callSerially
方法Display
对象avec类实现Runnable
void getThisAlert(String Title, Displayable txtagency2)
{
Alert error = new Alert("", Title, null, AlertType.INFO);
error.setTimeout(2000);
Display.getDisplay(myProject).setCurrent(error,txtagency2);
}
然后在数据验证例程中
private class ItemFocusEventHandler implements Runnable
{
private Item _Item = null;
public ItemFocusEventHandler(Item item)
{
_Item = item;
}
public void run()
{
try { Thread.sleep(1000); }
catch (Throwable t) { ; }
_display.setCurrentItem(_Item); // sets focus to item
}
}
这样,焦点将接收到
\u txtName
。您也可以将该处理程序用于其他UI元素 您可以使用callSerially
方法Display
对象avec类实现Runnable
void getThisAlert(String Title, Displayable txtagency2)
{
Alert error = new Alert("", Title, null, AlertType.INFO);
error.setTimeout(2000);
Display.getDisplay(myProject).setCurrent(error,txtagency2);
}
然后在数据验证例程中
private class ItemFocusEventHandler implements Runnable
{
private Item _Item = null;
public ItemFocusEventHandler(Item item)
{
_Item = item;
}
public void run()
{
try { Thread.sleep(1000); }
catch (Throwable t) { ; }
_display.setCurrentItem(_Item); // sets focus to item
}
}
这样,焦点将接收到\u txtName
。您也可以将该处理程序用于其他UI元素