如何获取带有文本框输入的对话框,以便我可以让用户输入PIN码?带黑莓文本框的对话框
0
A
回答
0
您可以让一个Popup screen
满足您的要求。请参阅Document here。并执行see this question on stackOverFlow。
这里是你可以改变你的要求换货
public class PinPopup extends PopupScreen //implements FieldChangeListener
{
public static EditField texts;
PinPopup()
{
super(new HorizontalFieldManager());
Font f = Font.getDefault().derive(Font.BOLD, 16);
setFont(f);
texts=new EditField("Pin: ","",15 , Field.EDITABLE);
ButtonField sendButton = new ButtonField(" Send "){
protected boolean navigationClick(int status, int time) {
//Do something with button
return true;
}
};
ButtonField cancelButton = new ButtonField("Cancel"){
protected boolean navigationClick(int status, int time) {
//Do something with button
return true;
}
};
Manager _fieldManagerContext = new Manager(USE_ALL_WIDTH)
{
public void sublayout(int width,int height) {
//super.sublayout(width, height);
int xpos = 10;
int ypos = 40;
Field field = getField(0);
layoutChild(field, 280, 50);
setPositionChild(field, xpos, ypos);
Field field1 = getField(1);
layoutChild(field1, 280, 50);
setPositionChild(field1, xpos, ypos+40);
Field field2 = getField(2);
layoutChild(field2, 280, 50);
setPositionChild(field2, xpos+20, ypos+100);
setPosition(300, 300);
setExtent(300, 300);
}
public void paint(Graphics graphics)
{
//graphics.setColor(Color.WHITE);
Font f = Font.getDefault().derive(Font.BOLD, 16);
graphics.setFont(f);
graphics.drawText("SEND PIN",90, 20,0,200);
//graphics.drawText(_userName,110,40,0,200);
graphics.setColor(Color.WHITE);
super.paint(graphics);
}
};
_fieldManagerContext.add(texts);
_fieldManagerContext.add(sendButton);
_fieldManagerContext.add(cancelButton);
add(_fieldManagerContext);
}
}
0
您可以创建一个CustomDialog延伸屏幕的代码。这也将帮助您获取用户在文本框中输入的引脚值。
public class CustomDialog extends Screen
{
public CustomDialog()
{
super(new VerticalFieldManager(), Screen.DEFAULT_CLOSE);
//add the whole UI here
}
//control the height and width of the Dialog with the help of this function
protected void sublayout(int width, int height)
{
layoutDelegate(width - 80, height - 80);
setPositionDelegate(10, 10);
setExtent(width - 60, Math.min(height - 60, getDelegate().getHeight() + 20));
setPosition(30, (height - getHeight())/2); // sets the position on the screen
}
}
试试这个希望这会对你有帮助。
同时呼吁该对话框,请参阅下面的代码..
UiApplication.getUiApplication().invokeLater(new Runnable()
{
public void run()
{
UiApplication.getUiApplication().pushModalScreen(new CustomDialog());
}
});
0
相关问题
- 1. 黑莓圆形文本框
- 2. 黑莓上的对话框中的文本字段
- 3. 在自定义对话框黑莓
- 4. 黑莓垂直滚动文本框
- 5. 更新SQLite表文本框黑莓
- 6. Android对话框,黑色背景上的黑色文本?
- 7. 在黑莓中有边框的多行文本框
- 8. 对齐黑莓上的复选框
- 9. 如何添加另一个按钮上的对话框黑莓
- 10. 如何在黑莓的编辑文本框中搜索文本?
- 11. 我们可以创建黑莓的Radiobuttons和复选框的提醒对话框
- 12. 黑莓:EventInjector导致安全定时器确认对话框
- 13. 模态对话框Jquery UI黑莓曲线问题
- 14. 黑莓:创建一个弹出式对话框
- 15. 黑莓:显示警报/状态/对话框年初和退出
- 16. 黑莓PIM演示设置闹钟/对话框/提醒
- 17. 在黑莓中创建一个自定义输入对话框
- 18. 带对话框的自定义进度条对话框框架
- 19. 带电话的黑莓应用程序
- 20. 对话框中的多行文本框
- 21. 黑莓AppWorld网页框
- 22. 黑莓UI提示框
- 23. 黑莓采用无边框
- 24. 带DataTable的JQuery对话框()
- 25. 带动画的对话框
- 26. 带有SDL的对话框/消息框?
- 27. 如何检测黑莓文本框字段上的事件?
- 28. 黑莓中的自定义多行文本框
- 29. 在文本框中输入文本的Jquery UI对话框块
- 30. 如何在黑莓应用程序中创建文本框
非常感谢你Swati!但它会抛出非法状态异常。我应该把这个类作为内部类吗?要么?? – Roses
我有jst编辑我的代码.. – Swati