ch.aplu.gidlet
Class MPanel

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by javax.microedition.lcdui.game.GameCanvas
              extended by ch.aplu.gidlet.MPanel

public class MPanel
extends javax.microedition.lcdui.game.GameCanvas

Simple graphics window of full display width and height (client drawing area) using a coordinate system with x-axis from left to right, y-axis from bottom to top (called window coordinates, default range 0..1, 0..1). The drawing methods perform all drawings in an offscreen buffer and automatically flush it on the display, so the graphics is shown step-by-step.

A current graph position is used, that remembers the end position of the last drawing process and where new drawings start.

If pixel accuracy is needed, use the graphcis methods starting with _

A soft button 'Exit' is shown. Hitting the corresponding key will call the Gidlet's doExit(). If you do not need this button, invoke removeExitButton().

If you implement your own CommandListener and call setCommandListener(), the internal CommandListener is disabled.

To avoid flickering in animated graphics, turn automatic flushing off by calling enableFlush(false). The drawing methods only modifies the offscreen buffer now. Call flushGraphics() to render it to the display.

main() serves as entry point for the user programm. It is called in the run-method of a separate thread and should terminate to avoid non-terminated threads.

An instance of MConsole may be created when declaring instance variable of the application program. To garantee that the initialization is executed in the Gidlet's thread, these instances are queued and the intialisation takes place in the same order they are created when main() is started.

Example:

 import ch.aplu.gidlet.*;
 public class GidletEx3 extends Gidlet
 {
   public void main()
   {
     MPanel mp = new MPanel(this, "Chessboard");
     mp.window(0, 8, 0, 8);
     mp.rectangle(0, 0, 8, 8);
      for (int i = 0; i < 8; i++)
        for (int j = 0; j < 8; j++)
          if ((i + j) % 2 == 0)
            mp.fillRectangle(i, j, i + 1, j + 1);
    }
  }
 

More than one instance may be created. The constructor flag visible may be used, to select if the display is initially shown or hidden. A hidden display will become visible by calling show(). There is no other way to make it hidden than showing a different display. All graphics methods may be called while the display is hidden.


Field Summary
 
Fields inherited from class javax.microedition.lcdui.game.GameCanvas
DOWN_PRESSED, FIRE_PRESSED, GAME_A_PRESSED, GAME_B_PRESSED, GAME_C_PRESSED, GAME_D_PRESSED, LEFT_PRESSED, RIGHT_PRESSED, UP_PRESSED
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
MPanel()
          Same as MPanel(visible) with visible = true.
MPanel(boolean visible)
          Constructs a MPanel and show the window with no title.
MPanel(double xmin, double xmax, double ymin, double ymax)
          Same as MPanel(xmin, xmax, ymin, ymax, visible) with visible = true.
MPanel(double xmin, double xmax, double ymin, double ymax, boolean visible)
          Constructs a MPanel and show the display with no title.
MPanel(java.lang.String title)
          Same as MPanel(title, visible) with visible = true.
MPanel(java.lang.String title, boolean visible)
          Constructs a MPanel and show the display with given title.
MPanel(java.lang.String title, double xmin, double xmax, double ymin, double ymax)
          Same as MPanel(title, xmin, xmax, ymin, ymax, visible) with visible = true.
MPanel(java.lang.String title, double xmin, double xmax, double ymin, double ymax, boolean visible)
          Constructs a MPanel and show the display with given title and given window coordinates, (0, 0) is at lower left corner which is the current graph cursor position.
 
Method Summary
 void _arc(int width, int height, int startAngle, int arcAngle)
          Draws an elliptical arc inside bounding rectangle centered at current graph position with given width and height in pixel coordinates.
 void _circle(int radius)
          Draws a circle with center at the current graph position and given radius in pixel coordinates.
 int _displayHeight()
          Returns height of display in pixel coordinates.
 int _displayWidth()
          Returns width of display in pixel coordinates.
 void _draw(int x, int y)
          Draws a line from current graph position to given pixel coordinates and sets the graph position to the endpoint.
 boolean _drawImage(java.lang.String imageUrl, int x, int y)
          Shows the PNG image from given file url at given pixel coordinates (upper left corner of image).
 void _drawSprite(javax.microedition.lcdui.game.Sprite sprite, int x, int y)
          Draws the given sprite at given pixel coordinates (upper left corner of image).
 void _fillArc(int width, int height, int startAngle, int arcAngle)
          Draws a filled elliptical arc inside bounding rectangle centered at current graph position with given width and height in pixel coordinates.
 void _fillCircle(int radius)
          Draws a filled circle with center at the current graph position and given radius in pixel coordinates.
 void _fillRectangle(int width, int height)
          Draws a filled rectangle with center at the current graph position and given width and height in window coordinates using the current color.
 void _fillRectangle(int x1, int y1, int x2, int y2)
          Draws a filled rectangle with given opposite corners in pixel coordinates.
 void _fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3)
          Draws a filled triangle with given corners in pixel coordintates using the current color.
 int _getPosX()
          Returns pixel coordinate x of current graph position.
 int _getPosY()
          Returns pixel coordinate y of current graph position.
 int _imageHeight(java.lang.String imageUrl)
          Returns the height (vertical size) of the PNG image from the given url (in pixel coordinates).
 int _imageWidth(java.lang.String imageUrl)
          Returns the width (horizontal size) of the PNG image from the given url (in pixel coordinates).
 void _label(java.lang.String text, int y)
          Draws the given text with current drawing color and font left adjusted at given y pixel coordinate.
 void _line(int x1, int y1, int x2, int y2)
          Draws a line with given pixel coordinates and sets the graph position to the endpoint.
 void _move(int x, int y)
          Sets the current graph position to given pixel coordinates (without drawing anything).
 void _point(int x, int y)
          Draws a single point at the given pixel coordinates.
 void _rectangle(int width, int height)
          Draws a rectangle with center at the current graph position and given width and height in pixel coordinates.
 void _rectangle(int x1, int y1, int x2, int y2)
          Draws a rectangle with given opposite corners in pixel coordinates.
 void _triangle(int x1, int y1, int x2, int y2, int x3, int y3)
          Draws a triangle with given corners in pixel coordintates.
 void addKeyListener(KeyListener keyListener)
          Registers an KeyListener to get a notification when a button is clicked.
 void addOkButton()
          Adds an OK soft button with label "OK".
 void addOkButton(java.lang.String label)
          Adds an OK soft button with given label.
 void arc(double width, double height, int startAngle, int arcAngle)
          Draws an elliptical arc inside bounding rectangle centered at current graph position with given width and height in window coordinates.
 int bgColor(int color)
          Sets the background color.
 void circle(double radius)
          Draws a circle with center at the current graph position and given radius in horizontal window coordinates.
 void clear()
          Clears the graphics window (fully paint with background color) (and the offscreen buffer used by the window).
 int color(int color)
          Sets the current color of the drawing pen.
 int color(int r, int g, int b)
          Sets the current color of the drawing pen in RGB-format.
 double displayHeight()
          Returns height of display in window coordinates.
 int displayResolutionX()
          Return numbers of pixels in horizontal direction.
 int displayResolutionY()
          Returns number of pixels in vertical direction.
 double displayWidth()
          Returns width of display in window coordinates.
 void draw(double x, double y)
          Draws a line from current graph position to given window coordinates and sets the graph position to the endpoint.
 boolean drawImage(java.lang.String imageUrl, double x, double y)
          Shows the PNG image from given file url at given window coordinates (upper left corner of image).
 void drawSprite(javax.microedition.lcdui.game.Sprite sprite, double x, double y)
          Draws the given sprite at given window coordinates (upper left corner of image).
 boolean enableFlush(boolean doFlush)
          Enables or disables the automatic flush in graphics methods.
 void erase()
          Same as clear() but let the current graph position unchanged.
 void fillArc(double width, double height, int startAngle, int arcAngle)
          Draws a filled elliptical arc inside bounding rectangle centered at current graph position with given width and height in window coordinates.
 void fillCircle(double radius)
          Draws a filled circle with center at the current graph position and given radius in horizonal window coordinates.
 void fillRectangle(double width, double height)
          Draws a filled rectangle with center at the current graph position and given width and height in window coordinates using the current color.
 void fillRectangle(double x1, double y1, double x2, double y2)
          Draws a filled rectangle with given opposite corners in window coordinates.
 void fillTriangle(double x1, double y1, double x2, double y2, double x3, double y3)
          Draws a filled triangle with given corners in window coordintates using the current color.
 void flush()
          Shortcut for flushGraphics()
 double getAspectRatio()
          Returns the ratio of canvas height to width.
 int getBgColor()
          Returns the current background color.
 int getColor()
          Returns the current drawing color.
 javax.microedition.lcdui.Graphics getG()
          Returns the graphics context.
 javax.microedition.lcdui.Image getImage(java.lang.String imageUrl)
          Loads image from given resource and returns it's Image reference.
 double getPosX()
          Returns window coordinate x of current graph position.
 double getPosY()
          Returns window coordinate y of current graph position.
 javax.microedition.lcdui.game.Sprite getSprite(java.lang.String imageUrl)
          Loads image from given resource and returns it's Sprite reference.
 javax.microedition.lcdui.game.Sprite getSprite(java.lang.String imageUrl, int frameWidth, int frameHeight)
          Loads image from given resource with given frameWidth, frameHeight and returns it's Sprite reference.
 double imageHeight(java.lang.String imageUrl)
          Returns the height (vertical size) of the PNG image from the given url (in window coordinates).
 double imageWidth(java.lang.String imageUrl)
          Returns the width (horizontal size) of the PNG image from the given url (in window coordinates).
protected  void init()
          Initializes MPanel.
protected  void keyPressed(int keyCode)
          Used to get key events.
protected  void keyReleased(int keyCode)
          Used to get key events.
protected  void keyRepeated(int keyCode)
          Used to get key events.
 void label(java.lang.String text, double y)
          Draws the given text with current drawing color and font left adjusted at given window y coordinate.
 void line(double x1, double y1, double x2, double y2)
          Draws a line with given window coordinates and sets the graph position to the endpoint.
 void move(double x, double y)
          Sets the current graph position to given window coordinates (without drawing anything).
 void point(double x, double y)
          Draws a single point at the given window coordinates.
 void rectangle(double width, double height)
          Draws a rectangle with center at the current graph position and given width and height in window coordinates.
 void rectangle(double x1, double y1, double x2, double y2)
          Draws a rectangle with given opposite corners in window coordinates.
 void removeExitButton()
          Removes Exit soft button.
 void removeKeyListener()
          Removes a registered KeyListener.
 void removeOkButton()
          Removes Ok soft button.
 void restorePanel()
          Renders the content of the internal offscreen buffer.
 void savePanel()
          Saves the current graphics content to an internal offscreen buffer.
 void setFont(int face, int style, int size)
          Sets the current text font for drawing labels.
 void show()
          Shows the form display if it is not yet visible or it was previously hidden by another display.
 void show(boolean wait)
          Shows the graphics display if it was previously hidden by another display or not yet displayed.
 void title(java.lang.String text)
          Draws the given title with current penColor centered in top area of display.
 int toPixelHeight(double windowHeight)
          Converts window coordinates increment to pixel coordinates increment (vertical).
 int toPixelWidth(double windowWidth)
          Converts window coordinates increment to pixel coordinates increment (horizontal).
 int toPixelX(double windowX)
          Converts window coordinates to pixel coordinates (horizontal).
 int toPixelY(double windowY)
          Converts window coordinates to pixel coordinates (vertical).
 double toWindowHeight(int pixelHeight)
          Converts pixel coordinates increment to window coordinates increment (vertical).
 double toWindowWidth(int pixelWidth)
          Converts pixel coordinates increment to window coordinates increment (horizontal).
 double toWindowX(int userX)
          Converts pixel coordinates to window coordinates (horizontal).
 double toWindowY(int userY)
          Converts pixel coordinates to window coordinates (vertical).
 void triangle(double x1, double y1, double x2, double y2, double x3, double y3)
          Draws a triangle with given corners in window coordintates.
 void window(double xmin, double xmax, double ymin, double ymax)
          Sets window coordinates.
 
Methods inherited from class javax.microedition.lcdui.game.GameCanvas
flushGraphics, flushGraphics, getGraphics, getKeyStates, paint
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setCommandListener, setFullScreenMode, showNotify, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MPanel

public MPanel(java.lang.String title,
              double xmin,
              double xmax,
              double ymin,
              double ymax,
              boolean visible)
Constructs a MPanel and show the display with given title and given window coordinates, (0, 0) is at lower left corner which is the current graph cursor position. The parameter visible controls, if the display is initially shown.


MPanel

public MPanel(java.lang.String title,
              double xmin,
              double xmax,
              double ymin,
              double ymax)
Same as MPanel(title, xmin, xmax, ymin, ymax, visible) with visible = true.


MPanel

public MPanel(double xmin,
              double xmax,
              double ymin,
              double ymax,
              boolean visible)
Constructs a MPanel and show the display with no title. given window coordinates. (0, 0) is at lower left corner which is the current graph cursor position. The parameter visible controls, if the display is initially shown.


MPanel

public MPanel(double xmin,
              double xmax,
              double ymin,
              double ymax)
Same as MPanel(xmin, xmax, ymin, ymax, visible) with visible = true.


MPanel

public MPanel(java.lang.String title,
              boolean visible)
Constructs a MPanel and show the display with given title. Window coordinates are 0, 1, 0, 1. (0, 0) is at lower left corner which is the current graph cursor position. The parameter visible controls, if the display is initially shown.


MPanel

public MPanel(java.lang.String title)
Same as MPanel(title, visible) with visible = true.


MPanel

public MPanel(boolean visible)
Constructs a MPanel and show the window with no title. Window coordinates are 0, 1, 0, 1. (0, 0) is at lower left corner which is the current graph cursor position. The parameter visible controls, if the display is initially shown.


MPanel

public MPanel()
Same as MPanel(visible) with visible = true.

Method Detail

init

protected void init()
Initializes MPanel. Called by main() if MPanel is created before main() is called.


show

public void show()
Shows the form display if it is not yet visible or it was previously hidden by another display. Because it is not garanteed that the diplay is actually visible when Display.setCurrent() returns, wait for a maximum of 5 s for the display to get shown.


show

public void show(boolean wait)
Shows the graphics display if it was previously hidden by another display or not yet displayed.
If wait = true, block until the display becomes actually visible, up to a maximum auf 5 seconds. This may be useful to observe the start of an animation.


bgColor

public int bgColor(int color)
Sets the background color. All drawing are erased. Returns the previous color.


getBgColor

public int getBgColor()
Returns the current background color.


getColor

public int getColor()
Returns the current drawing color.


enableFlush

public boolean enableFlush(boolean doFlush)
Enables or disables the automatic flush in graphics methods. Returns the current state of flushing.
When automatic flush is disabled, the method flushGraphics() must be called to show the image on the display.
Useful to avoid flickering while animating an image. If flush is disabled clear() will only erase the offscreen buffer and not the display. flushGraphics() should be called after drawing the new situation in order to copy the offscreen buffer to the display.


clear

public void clear()
Clears the graphics window (fully paint with background color) (and the offscreen buffer used by the window). Sets the current graph position to window coordiantes (0, 0).
If enableFlush(false) only clear the offscreen buffer.


erase

public void erase()
Same as clear() but let the current graph position unchanged.


_circle

public void _circle(int radius)
Draws a circle with center at the current graph position and given radius in pixel coordinates. The graph position is unchanged.


circle

public void circle(double radius)
Draws a circle with center at the current graph position and given radius in horizontal window coordinates. The graph position is unchanged.


_fillCircle

public void _fillCircle(int radius)
Draws a filled circle with center at the current graph position and given radius in pixel coordinates. The graph position is unchanged.


fillCircle

public void fillCircle(double radius)
Draws a filled circle with center at the current graph position and given radius in horizonal window coordinates. The graph position is unchanged.


_arc

public void _arc(int width,
                 int height,
                 int startAngle,
                 int arcAngle)
Draws an elliptical arc inside bounding rectangle centered at current graph position with given width and height in pixel coordinates. The arc starts at given startAngle and covers the given arcAngle (both in degrees). The graph position is unchanged.


arc

public void arc(double width,
                double height,
                int startAngle,
                int arcAngle)
Draws an elliptical arc inside bounding rectangle centered at current graph position with given width and height in window coordinates. The arc starts at given startAngle (with respect to east direction) and covers the given arcAngle (counter-clockwise) (both angles in degrees). The graph position is unchanged.


_fillArc

public void _fillArc(int width,
                     int height,
                     int startAngle,
                     int arcAngle)
Draws a filled elliptical arc inside bounding rectangle centered at current graph position with given width and height in pixel coordinates. The arc starts at given startAngle and covers the given arcAngle (both in degrees). The graph position is unchanged.


fillArc

public void fillArc(double width,
                    double height,
                    int startAngle,
                    int arcAngle)
Draws a filled elliptical arc inside bounding rectangle centered at current graph position with given width and height in window coordinates. The arc starts at given startAngle (with respect to east direction) and covers the given arcAngle (counter-clockwise) (both angles in degrees). The graph position is unchanged.


color

public int color(int color)
Sets the current color of the drawing pen. Returns the previous color.


color

public int color(int r,
                 int g,
                 int b)
Sets the current color of the drawing pen in RGB-format. Returns the previous color.


flush

public void flush()
Shortcut for flushGraphics()


title

public void title(java.lang.String text)
Draws the given title with current penColor centered in top area of display. Does not erase previous text at same position.


_label

public void _label(java.lang.String text,
                   int y)
Draws the given text with current drawing color and font left adjusted at given y pixel coordinate. Erases previous text at same position. To position the text horizontally, use leading spaces.

See Also:
color(int), setFont(int, int, int)

label

public void label(java.lang.String text,
                  double y)
Draws the given text with current drawing color and font left adjusted at given window y coordinate. Does not erase previous text at same position. To position the text horizontally, use leading spaces.

See Also:
color(int), setFont(int, int, int)

_point

public void _point(int x,
                   int y)
Draws a single point at the given pixel coordinates. The graph position is set to the given point.


point

public void point(double x,
                  double y)
Draws a single point at the given window coordinates. The graph position is set to the given point.


_line

public void _line(int x1,
                  int y1,
                  int x2,
                  int y2)
Draws a line with given pixel coordinates and sets the graph position to the endpoint.


line

public void line(double x1,
                 double y1,
                 double x2,
                 double y2)
Draws a line with given window coordinates and sets the graph position to the endpoint.


_draw

public void _draw(int x,
                  int y)
Draws a line from current graph position to given pixel coordinates and sets the graph position to the endpoint.


draw

public void draw(double x,
                 double y)
Draws a line from current graph position to given window coordinates and sets the graph position to the endpoint.


_move

public void _move(int x,
                  int y)
Sets the current graph position to given pixel coordinates (without drawing anything).


move

public void move(double x,
                 double y)
Sets the current graph position to given window coordinates (without drawing anything).


_triangle

public void _triangle(int x1,
                      int y1,
                      int x2,
                      int y2,
                      int x3,
                      int y3)
Draws a triangle with given corners in pixel coordintates. The graph position is unchanged.


triangle

public void triangle(double x1,
                     double y1,
                     double x2,
                     double y2,
                     double x3,
                     double y3)
Draws a triangle with given corners in window coordintates. The graph position is unchanged.


_fillTriangle

public void _fillTriangle(int x1,
                          int y1,
                          int x2,
                          int y2,
                          int x3,
                          int y3)
Draws a filled triangle with given corners in pixel coordintates using the current color. The graph position is unchanged.


fillTriangle

public void fillTriangle(double x1,
                         double y1,
                         double x2,
                         double y2,
                         double x3,
                         double y3)
Draws a filled triangle with given corners in window coordintates using the current color. The graph position is unchanged.


_rectangle

public void _rectangle(int width,
                       int height)
Draws a rectangle with center at the current graph position and given width and height in pixel coordinates. The graph position is unchanged.


rectangle

public void rectangle(double width,
                      double height)
Draws a rectangle with center at the current graph position and given width and height in window coordinates. The graph position is unchanged.


_rectangle

public void _rectangle(int x1,
                       int y1,
                       int x2,
                       int y2)
Draws a rectangle with given opposite corners in pixel coordinates. The graph position is unchanged.


rectangle

public void rectangle(double x1,
                      double y1,
                      double x2,
                      double y2)
Draws a rectangle with given opposite corners in window coordinates. The graph position is unchanged.


_fillRectangle

public void _fillRectangle(int width,
                           int height)
Draws a filled rectangle with center at the current graph position and given width and height in window coordinates using the current color. The graph position is unchanged.


fillRectangle

public void fillRectangle(double width,
                          double height)
Draws a filled rectangle with center at the current graph position and given width and height in window coordinates using the current color. The graph position is unchanged.


_fillRectangle

public void _fillRectangle(int x1,
                           int y1,
                           int x2,
                           int y2)
Draws a filled rectangle with given opposite corners in pixel coordinates. The graph position is unchanged.


fillRectangle

public void fillRectangle(double x1,
                          double y1,
                          double x2,
                          double y2)
Draws a filled rectangle with given opposite corners in window coordinates. The graph position is unchanged.


window

public void window(double xmin,
                   double xmax,
                   double ymin,
                   double ymax)
Sets window coordinates. left_x, right_x, bottom_y, top_y


toPixelX

public int toPixelX(double windowX)
Converts window coordinates to pixel coordinates (horizontal).


toPixelY

public int toPixelY(double windowY)
Converts window coordinates to pixel coordinates (vertical).


toPixelWidth

public int toPixelWidth(double windowWidth)
Converts window coordinates increment to pixel coordinates increment (horizontal). Increment is always positive.


toPixelHeight

public int toPixelHeight(double windowHeight)
Converts window coordinates increment to pixel coordinates increment (vertical). Increment is always positive.


toWindowX

public double toWindowX(int userX)
Converts pixel coordinates to window coordinates (horizontal).


toWindowY

public double toWindowY(int userY)
Converts pixel coordinates to window coordinates (vertical).


toWindowWidth

public double toWindowWidth(int pixelWidth)
Converts pixel coordinates increment to window coordinates increment (horizontal). Increment is always positive.


toWindowHeight

public double toWindowHeight(int pixelHeight)
Converts pixel coordinates increment to window coordinates increment (vertical). Increment is always positive.


getAspectRatio

public double getAspectRatio()
Returns the ratio of canvas height to width.


getG

public javax.microedition.lcdui.Graphics getG()
Returns the graphics context.


_getPosX

public int _getPosX()
Returns pixel coordinate x of current graph position.


getPosX

public double getPosX()
Returns window coordinate x of current graph position.


_getPosY

public int _getPosY()
Returns pixel coordinate y of current graph position.


getPosY

public double getPosY()
Returns window coordinate y of current graph position.


addKeyListener

public void addKeyListener(KeyListener keyListener)
Registers an KeyListener to get a notification when a button is clicked.


removeKeyListener

public void removeKeyListener()
Removes a registered KeyListener.


getImage

public javax.microedition.lcdui.Image getImage(java.lang.String imageUrl)
Loads image from given resource and returns it's Image reference. Returns null, if loading fails.


getSprite

public javax.microedition.lcdui.game.Sprite getSprite(java.lang.String imageUrl)
Loads image from given resource and returns it's Sprite reference. Returns null, if loading fails.


getSprite

public javax.microedition.lcdui.game.Sprite getSprite(java.lang.String imageUrl,
                                                      int frameWidth,
                                                      int frameHeight)
Loads image from given resource with given frameWidth, frameHeight and returns it's Sprite reference. Returns null, if loading fails.


_drawSprite

public void _drawSprite(javax.microedition.lcdui.game.Sprite sprite,
                        int x,
                        int y)
Draws the given sprite at given pixel coordinates (upper left corner of image). If sprite == null, nothing happens. Image transparancy is supported. Transparent parts must be created by editing the png-file.


drawSprite

public void drawSprite(javax.microedition.lcdui.game.Sprite sprite,
                       double x,
                       double y)
Draws the given sprite at given window coordinates (upper left corner of image). If sprite == null, nothing happens. Image transparancy is supported. Transparent parts must be created by editing the png-file.


_drawImage

public boolean _drawImage(java.lang.String imageUrl,
                          int x,
                          int y)
Shows the PNG image from given file url at given pixel coordinates (upper left corner of image). Returns true if successful. If enableFlush(false), the image is drawn in offscreen buffer only. Image transparancy is supported. Transparent parts must be created by editing the png-file.


drawImage

public boolean drawImage(java.lang.String imageUrl,
                         double x,
                         double y)
Shows the PNG image from given file url at given window coordinates (upper left corner of image). Returns true if successful. If enableFlush(false), the image is drawn in offscreen buffer only. Image transparancy is supported. Transparent parts must be created by editing the png-file.


_imageWidth

public int _imageWidth(java.lang.String imageUrl)
Returns the width (horizontal size) of the PNG image from the given url (in pixel coordinates). Returns 0, if PNG image is invalid.


imageWidth

public double imageWidth(java.lang.String imageUrl)
Returns the width (horizontal size) of the PNG image from the given url (in window coordinates). Returns 0, if PNG image is invalid.


_imageHeight

public int _imageHeight(java.lang.String imageUrl)
Returns the height (vertical size) of the PNG image from the given url (in pixel coordinates). Returns 0, if PNG image is invalid.


imageHeight

public double imageHeight(java.lang.String imageUrl)
Returns the height (vertical size) of the PNG image from the given url (in window coordinates). Returns 0, if PNG image is invalid.


_displayWidth

public int _displayWidth()
Returns width of display in pixel coordinates. Pixel coordinates 0 up to this value (inclusive) Number of pixels: this value + 1


displayResolutionX

public int displayResolutionX()
Return numbers of pixels in horizontal direction.


displayWidth

public double displayWidth()
Returns width of display in window coordinates.


_displayHeight

public int _displayHeight()
Returns height of display in pixel coordinates. Pixel coordinates 0 up to this value (inclusive) Number of pixels: this value + 1


displayResolutionY

public int displayResolutionY()
Returns number of pixels in vertical direction.


displayHeight

public double displayHeight()
Returns height of display in window coordinates.


setFont

public void setFont(int face,
                    int style,
                    int size)
Sets the current text font for drawing labels. If the font is changed, existing text is not affected. Default font is FACE_SYSTEM, STYLE_PLAIN, SIZE_MEDIUM.

Parameters:
face - one of Font.FACE_SYSTEM, Font.FACE_MONOSPACE, or Font.FACE_PROPORTIONAL
style - Font.STYLE_PLAIN, or a combination of Font.STYLE_BOLD, Font.STYLE_ITALIC, and Font.STYLE_UNDERLINED
size - one of Font.SIZE_SMALL, Font.SIZE_MEDIUM, or Font.SIZE_LARGE

keyPressed

protected void keyPressed(int keyCode)
Used to get key events.

Overrides:
keyPressed in class javax.microedition.lcdui.Canvas

keyReleased

protected void keyReleased(int keyCode)
Used to get key events.

Overrides:
keyReleased in class javax.microedition.lcdui.Canvas

keyRepeated

protected void keyRepeated(int keyCode)
Used to get key events.

Overrides:
keyRepeated in class javax.microedition.lcdui.Canvas

savePanel

public void savePanel()
Saves the current graphics content to an internal offscreen buffer. Useful to move another graphics object on this background image by repetive call of restorePanel() and graphics commands.

See Also:
restorePanel()

restorePanel

public void restorePanel()
Renders the content of the internal offscreen buffer. If no image has been stored nothing happens.

See Also:
savePanel()

addOkButton

public void addOkButton()
Adds an OK soft button with label "OK". When pressed, the Gidlet's callback notification doOk() is called unless you register your own CommandListener.


addOkButton

public void addOkButton(java.lang.String label)
Adds an OK soft button with given label. When pressed, the Gidlet's callback notification doOk() is called unless you register your own CommandListener.


removeExitButton

public void removeExitButton()
Removes Exit soft button. Gidlet's callback notification doExit() is disabled.


removeOkButton

public void removeOkButton()
Removes Ok soft button. Gidlet's callback notification doOk() is disabled.