Java Code Examples for javax.microedition.lcdui.Command#OK
The following examples show how to use
javax.microedition.lcdui.Command#OK .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameCanvasImplementation.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void setCommands(Vector v) { if(currentCommands != null) { for(int iter = 0 ; iter < currentCommands.length ; iter++) { removeCommand(currentCommands[iter]); } } setCommandListener(this); currentCommands = new Command[v.size()]; com.codename1.ui.Command backCommand = null; if(Display.getInstance().getCurrent() != null) { backCommand = Display.getInstance().getCurrent().getBackCommand(); } for(int iter = 0 ; iter < currentCommands.length ; iter++) { com.codename1.ui.Command current = (com.codename1.ui.Command)v.elementAt(iter); if(current == backCommand) { currentCommands[iter] = new MIDP2CodenameOneCommand(current, Command.BACK, iter + 1); } else { if(iter == 0) { currentCommands[iter] = new MIDP2CodenameOneCommand(current, Command.OK, iter + 1); } else { currentCommands[iter] = new MIDP2CodenameOneCommand(current, iter + 1); } } addCommand(currentCommands[iter]); } }
Example 2
Source File: GameCanvasImplementation.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
/** * @inheritDoc */ public void editString(Component cmp, int maxSize, int constraint, String text, int keyCode) { UIManager m = UIManager.getInstance(); CONFIRM_COMMAND = new Command(m.localize("ok", "OK"), Command.OK, 1); CANCEL_COMMAND = new Command(m.localize("cancel", "Cancel"), Command.CANCEL, 2); if(mid.getAppProperty("forceBackCommand") != null) { canvas.addCommand(MIDP_BACK_COMMAND); } currentTextBox = new TextBox("", "", maxSize, TextArea.ANY); currentTextBox.setCommandListener((CommandListener)canvas); currentTextBox.addCommand(CONFIRM_COMMAND); currentTextBox.addCommand(CANCEL_COMMAND); currentTextComponent = cmp; currentTextBox.setMaxSize(maxSize); currentTextBox.setString(text); currentTextBox.setConstraints(constraint); display.setCurrent(currentTextBox); ((C)canvas).setDone(false); Display.getInstance().invokeAndBlock(((C)canvas)); }
Example 3
Source File: CommentDetailsView.java From pluotsorbet with GNU General Public License v2.0 | 5 votes |
/** * Show the 'Reply' view (a full-screen TextBox). */ private void showReplyView() { final Command cancelCommand = new Command("Cancel", Command.BACK, 0); final Command sendCommand = new Command("Send", Command.OK, 0); replyView = new TextBox("Reply", null, 2000, TextField.ANY); replyView.addCommand(cancelCommand); replyView.addCommand(sendCommand); replyView.setCommandListener(new CommandListener() { public void commandAction(Command command, Displayable d) { // Cancel and return back to previous view if (command == cancelCommand) { setDisplay(self); } // Submit command else if (command == sendCommand) { String modhash = session.getModhash(); replyOperation = new CommentPostOperation( item.getName(), replyView.getString(), modhash, (PostCommentListener) self ); replyOperation.start(); } } }); setDisplay(replyView); }