private void startComponents() { this.cmdBack = new Command("Back", Command.BACK, 0); this.addCommand(this.cmdBack); this.setCommandListener(this); }
public void removeCommandUI(CommandUI cmd) { commands.removeElement(cmd); if (displayable.isShown()) { updateCommands(); } }
/** * Do the logging. * * @param level * the level at which the logging shall be done. * @param message * the message to log. * @param throwable * the exception to log. */ public void doLog(String clientID, String name, long time, Level level, Object message, Throwable throwable) { if (isOpen && formatter != null) { logStrings.addElement(formatter.format(clientID, name, time, level, message, throwable)); } // Scroll down screen to show the last line entered when a new line is // added while (lineSize * (logStrings.size() - screenOffset) > this.getHeight()) { screenOffset++; } // Request screen repaint this.repaint(); }
public int getClipWidth() { Rectangle rect = g.getClipping(); if (rect == null) { DisplayAccess da = MIDletBridge.getMIDletAccess().getDisplayAccess(); return da.getCurrent().getWidth(); } else { return rect.width; } }
/** * Called when a key is pressed. * * @param keyCode * the key kode of the key that was pressed. */ protected void keyPressed(int keyCode) { switch (this.getGameAction(keyCode)) { case UP: if (screenOffset > 0) { screenOffset--; } break; case DOWN: if (lineSize * (logStrings.size() - screenOffset) > this .getHeight()) { screenOffset++; } break; default: break; } // Request screen repaint repaint(); }
private void startComponents() { this.cmdBack = new Command("Back", Command.BACK, 0); this.addCommand(this.cmdBack); this.cmdLeave = new Command("Leave", Command.ITEM, 1); this.addCommand(this.cmdLeave); this.setCommandListener(this); }
/** * Draws log entries to the screen * * @param g * the <code>Graphics</code> object to use for drawing. */ public void paint(Graphics g) { // Erase screen g.setColor(255, 255, 255); g.fillRect(0, 0, this.getWidth(), this.getHeight()); g.setColor(0, 0, 0); // Draw all lines int count = 1; for (int index = screenOffset; index < logStrings.size(); index++) { g.drawString(logStrings.elementAt(index).toString(), 0, count * lineSize, Graphics.BASELINE | Graphics.LEFT); count++; } }
public int getClipHeight() { Rectangle rect = g.getClipping(); if (rect == null) { DisplayAccess da = MIDletBridge.getMIDletAccess().getDisplayAccess(); return da.getCurrent().getHeight(); } else { return rect.height; } }
public void addCommandUI(CommandUI cmd) { // Check that its not the same command for (int i = 0; i < commands.size(); i++) { if (cmd == (CommandUI) commands.elementAt(i)) { // Its the same just return return; } } // Now insert it in order boolean inserted = false; for (int i = 0; i < commands.size(); i++) { if (cmd.getCommand().getPriority() < ((CommandUI) commands.elementAt(i)).getCommand().getPriority()) { commands.insertElementAt(cmd, i); inserted = true; break; } } if (inserted == false) { // Not inserted just place it at the end commands.addElement(cmd); } if (displayable.isShown()) { updateCommands(); } }
/*************************************************************************** * Returns the javax.microedition.lcdui.List instance to append the result * data to. Will be created if it doesn't exist. * * @return A javax.microedition.lcdui.List object */ protected List getResultsList() { if (aResultsList == null) { aResultsList = new List("J2ME Unit", List.IMPLICIT); // v.s. aResultsList.addCommand(cmd_exit); aResultsList.setCommandListener(this); } return aResultsList; }
private void startComponents() { this.cmdBack = new Command("Back", Command.BACK, 0); this.addCommand(this.cmdBack); this.cmdCreate = new Command("Create", Command.ITEM, 1); this.addCommand(this.cmdCreate); this.cmdEdit = new Command("Edit", Command.ITEM, 2); this.addCommand(this.cmdEdit); this.cmdDelete = new Command("Delete", Command.ITEM, 3); this.addCommand(this.cmdDelete); this.setCommandListener(this); }
private void startComponents() { this.cmdBack = new Command("Back", Command.BACK, 0); this.addCommand(this.cmdBack); this.cmdCreate = new Command("Create", Command.ITEM, 1); this.addCommand(this.cmdCreate); this.cmdEdit = new Command("Edit", Command.ITEM, 2); this.addCommand(this.cmdEdit); this.cmdDelete = new Command("Delete", Command.ITEM, 3); this.addCommand(this.cmdDelete); this.setCommandListener(this); }
private void startComponents() { this.cmdBack = new Command("Back", Command.BACK, 0); this.addCommand(this.cmdBack); this.cmdCreate = new Command("Create", Command.ITEM, 1); this.addCommand(this.cmdCreate); this.cmdEdit = new Command("Edit", Command.ITEM, 2); this.addCommand(this.cmdEdit); this.cmdDelete = new Command("Delete", Command.ITEM, 3); this.addCommand(this.cmdDelete); this.setCommandListener(this); }
/** * Create a RecordStoreLogViewer. */ public RecordStoreLogViewer() { super(); display = Display.getDisplay(this); logScreen = new Form("Log content"); logScreen.addCommand(loadLogCommand); logScreen.addCommand(clearLogCommand); logScreen.addCommand(preferenceCommand); logScreen.addCommand(exitCommand); logScreen.addCommand(switchComparatorCommand); logScreen.setCommandListener(this); preferenceScreen = new Form("Preferences"); nameField = new TextField("RecordStore name ", null, MAX_NAME_LENGTH, TextField.ANY); preferenceScreen.append(nameField); preferenceScreen.addCommand(preferenceOkCommand); preferenceScreen.addCommand(preferenceCancelCommand); preferenceScreen.addCommand(exitCommand); preferenceScreen.setCommandListener(this); }
private void startComponents() { this.cmdBack = new Command("Back", Command.BACK, 0); this.addCommand(this.cmdBack); this.cmdCreate = new Command("Create", Command.ITEM, 1); this.addCommand(this.cmdCreate); this.cmdEdit = new Command("Edit", Command.ITEM, 2); this.addCommand(this.cmdEdit); this.cmdDelete = new Command("Delete", Command.ITEM, 3); this.addCommand(this.cmdDelete); this.cmdSearch = new Command("Search", Command.ITEM, 4); this.addCommand(this.cmdSearch); this.setCommandListener(this); }
private void startComponents() { this.txtSearch = new TextField("Name", null, 20, TextField.ANY); this.append(this.txtSearch); this.cmdOk = new Command("Ok", Command.OK, 0); this.addCommand(this.cmdOk); this.cmdCancel = new Command("Cancel", Command.CANCEL, 1); this.addCommand(this.cmdCancel); this.setCommandListener(this); } }
private void startComponents() { this.txtFormation = new TextField("Formation", formation.getFormation(), 30, TextField.ANY); this.append(this.txtFormation); this.cmdOk = new Command("Ok", Command.OK, 0); this.addCommand(this.cmdOk); this.cmdCancel = new Command("Cancel", Command.CANCEL, 1); this.addCommand(this.cmdCancel); this.setCommandListener(this); } }
/** * Creates a new BarbecueCalculatorMIDlet object. */ public BarbecueCalculatorMIDlet() { try { DisplayManager.startDisplayManager(this); FlowManager.startFlowManager(this); this.initialScreen = new InitialScreenCanvas(); this.initialScreen.addCommand(CommandHandler.CALCULATE_CMD); this.initialScreen.addCommand(CommandHandler.SAVED_CMD); this.initialScreen.addCommand(CommandHandler.ABOUT_CMD); this.initialScreen.addCommand(CommandHandler.EXIT_CMD); this.initialScreen.setCommandListener(CommandHandler.getInstance()); DisplayManager.getInstance().pushToShowStack(this.initialScreen); } catch (Exception e) { } }
private void startComponents() { this.txtBedNumber = new TextField("Bed number", String.valueOf(bed.getNumber()), 3, TextField.NUMERIC); this.append(this.txtBedNumber); this.txtBedFloor = new TextField("Bed floor", String.valueOf(bed.getFloor()), 15, TextField.NUMERIC); this.append(this.txtBedFloor); this.cmdOk = new Command("Ok", Command.OK, 0); this.addCommand(this.cmdOk); this.cmdCancel = new Command("Cancel", Command.CANCEL, 1); this.addCommand(this.cmdCancel); this.setCommandListener(this); } }