如何獲取帶有文本框輸入的對話框,以便我可以讓用戶輸入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. 更新SQLite表文本框黑莓
- 5. 黑莓垂直滾動文本框
- 6. Android對話框,黑色背景上的黑色文本?
- 7. 在黑莓中有邊框的多行文本框
- 8. 對齊黑莓上的複選框
- 9. 如何添加另一個按鈕上的對話框黑莓
- 10. 如何在黑莓的編輯文本框中搜索文本?
- 11. 我們可以創建黑莓的Radiobuttons和複選框的提醒對話框
- 12. 對話框中的多行文本框
- 13. 模態對話框Jquery UI黑莓曲線問題
- 14. 黑莓PIM演示設置鬧鐘/對話框/提醒
- 15. 黑莓:創建一個彈出式對話框
- 16. 在黑莓中創建一個自定義輸入對話框
- 17. 黑莓:EventInjector導致安全定時器確認對話框
- 18. 黑莓:顯示警報/狀態/對話框年初和退出
- 19. 帶電話的黑莓應用程序
- 20. 黑莓UI提示框
- 21. 黑莓採用無邊框
- 22. 黑莓AppWorld網頁框
- 23. 帶動畫的對話框
- 24. 帶有SDL的對話框/消息框?
- 25. 如何檢測黑莓文本框字段上的事件?
- 26. 黑莓中的自定義多行文本框
- 27. 如何在黑莓應用程序中創建文本框
- 28. 編輯帶有提醒對話框的文本
- 29. 帶文本和按鈕的Java對話框
- 30. 帶對話框的默認輸入文本
非常感謝你Swati!但它會拋出非法狀態異常。我應該把這個類作爲內部類嗎?要麼?? – Roses
我有jst編輯我的代碼.. – Swati