/** * DOCUMENT ME! * * @param g DOCUMENT ME! */ protected void paint(Graphics g) { g.drawImage(this.barbecueImage, this.getWidth() / 2, this.getHeight() / 2, Graphics.VCENTER | Graphics.HCENTER); } }
/** * 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(); }
/** * 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(); }
/** * 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; } }