⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canvas.java

📁 有关j2me的很好的例子可以研究一下
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     *     * <P>Constant value 9 is set to GAME_A.</P>     */    public static final int GAME_A = 9;         /**     * <P>Constant for the general purpose "B" game action.</P>     *     * <P>Constant value 10 is set to GAME_B.</P>     */    public static final int GAME_B = 10;         /**     * <P>Constant for the general purpose "C" game action.</P>     *     * <P>Constant value 11 is set to GAME_C.</P>     */    public static final int GAME_C = 11;        /**     * <P>Constant for the general purpose "D" game action.</P>     *     * <P>Constant value 12 is set to GAME_D.</P>     */    public static final int GAME_D = 12;         /**     * <P>keyCode for ITU-T key 0.</P>     *     * <P>Constant value 48 is set to KEY_NUM0.</P>     */    public static final int KEY_NUM0  =  48;        /**     * <P>keyCode for ITU-T key 1.</P>     *     * <P>Constant value 49 is set to KEY_NUM1.</P>     */    public static final int KEY_NUM1  =  49;        /**     * <P>keyCode for ITU-T key 2.</P>     *     * <P>Constant value 50 is set to KEY_NUM2.</P>     */    public static final int KEY_NUM2  =  50;        /**     * <P>keyCode for ITU-T key 3.</P>     *     * <P>Constant value 51 is set to KEY_NUM3.</P>     */    public static final int KEY_NUM3 = 51;        /**     * <P>keyCode for ITU-T key 4.</P>     *     * <P>Constant value 52 is set to KEY_NUM4.</P>     */    public static final int KEY_NUM4 = 52;        /**     * <P>keyCode for ITU-T key 5.</P>     *     * <P>Constant value 53 is set to KEY_NUM5.</P>     */    public static final int KEY_NUM5 = 53;        /**     * <P>keyCode for ITU-T key 6.</P>     *     * <P>Constant value 54 is set to KEY_NUM6.</P>     */    public static final int KEY_NUM6 = 54;        /**     * <P>keyCode for ITU-T key 7.</P>     *     * <P>Constant value 55 is set to KEY_NUM7.</P>     */    public static final int KEY_NUM7 = 55;        /**     * <P>keyCode for ITU-T key 8.</P>     *     * <P>Constant value 56 is set to KEY_NUM8.</P>     */    public static final int KEY_NUM8 = 56;        /**     * <P>keyCode for ITU-T key 9.</P>     *     * <P>Constant value 57 is set to KEY_NUM09.</P>     */    public static final int KEY_NUM9 = 57;        /**     * <P>keyCode for ITU-T key "star" (*).</P>     *     * <P>Constant value 42 is set to KEY_STAR.</P>     */    public static final int KEY_STAR = 42;        /**     * <P>keyCode for ITU-T key "pound" (#).</P>     *     * <P>Constant value 35 is set to KEY_POUND.</P>     */    public static final int KEY_POUND = 35;    /**     * Constructs a new Canvas object.     */    protected Canvas()  { }        /**     * Gets width of the displayable area in pixels. The value is unchanged     * during the execution of the application and all Canvases will      * have the same value.     * @return width of the displayable area     */    public int getWidth() {        // SYNC NOTE: return of atomic value, no locking necessary        return Display.WIDTH;    }        /**     * Gets height of the displayable area in pixels. The value is unchanged     * during the execution of the application and all Canvases will     * have the same value.     * @return height of the displayable area     */    public int getHeight() {        // SYNC NOTE: return of atomic value, no locking necessary        return Display.HEIGHT;    }        /**     * Checks if the Graphics is double buffered by the implementation.     * @return true if double buffered, false otherwise.     */    public boolean isDoubleBuffered() {        // SYNC NOTE: return of atomic value, no locking necessary        return Display.IS_DOUBLE_BUFFERED;    }    /**     * Checks if the platform supports pointer press and release events.     * @return true if the device supports pointer events     */    public boolean hasPointerEvents() {        // SYNC NOTE: return of atomic value, no locking necessary        return Display.POINTER_SUPPORTED;    }        /**     * Checks if the platform supports pointer motion events (pointer dragged).     * Applications may use this method to determine if the platform is capable     * of supporting motion events.     * @return true if the device supports pointer motion events     */    public boolean hasPointerMotionEvents() {        // SYNC NOTE: return of atomic value, no locking necessary        return Display.MOTION_SUPPORTED;    }        /**     * Checks if the platform can generate repeat events when key     * is kept down.     * @return true if the device supports repeat events     */    public boolean hasRepeatEvents() {         // SYNC NOTE: return of atomic value, no locking necessary        return Display.REPEAT_SUPPORTED;    }        /**     * <p>Gets a key code that corresponds to the specified game action on the     * device.  The implementation is required to provide a mapping for every     * game action, so this method will always return a valid key code for     * every game action.  See <a href="#gameactions">above</a> for further     * discussion of game actions.</p>     *      * <p>Note that a key code is associated with at most one game action,     * whereas a game action may be associated with several key codes.  Then,     * supposing that <code>g</code> is a valid game action and <code>k</code>     * is a valid key code for a key associated with a game action, consider     * the following expressions:</p>     *     * <pre>     *    g == getGameAction(getKeyCode(g))     // (1)     *    k == getKeyCode(getGameAction(k))     // (2)     * </pre>     *     * <p>Expression (1) is <em>always</em> true.  However, expression (2) might     * be true but is <em>not necessarily</em> true.</p>     *     * <P>The mapping between key codes and game actions     * will not change during the execution of the application.</P>     *     * @param gameAction the game action     * @return a key code corresponding to this game action     * @throws IllegalArgumentException if gameAction is not a valid game action     */    public int getKeyCode(int gameAction) {        // SYNC NOTE: no locking necessary as we are doing a static        // table lookup and getKeyCode() is implemented natively        int n = Display.getKeyCode(gameAction);        if (n == 0) {            throw new IllegalArgumentException();        }        return n;    }        /**     * <p> Gets an informative key string for a key. The string returned will     * resemble the text physically printed on the key.  This string is      * suitable for displaying to the user.  For example, on a device     * with function keys F1 through F4, calling this method on the keyCode for     * the F1 key will return the string "F1". A typical use for this string     * will be to compose help text such as "Press F1 to proceed." </p>     *     * <p> This method will return a non-empty string for every valid key code.     * </p>     *     * <p> There is no direct mapping from game actions to key names. To get     * the string name for a game action GAME_A, the application must call </p>     *     * <pre>     *    getKeyName(getKeyCode(GAME_A))     * </pre>     *     * @param keyCode the key code being requested     * @return a string name for the key     * @throws IllegalArgumentException if keyCode is not a valid key code     */    public String getKeyName(int keyCode) {        // SYNC NOTE: no locking necessary as we are doing a static        // table lookup and getKeyName() is implemented natively        String s = Display.getKeyName(keyCode);        if (s == null) {            throw new IllegalArgumentException();        }        return s;    }    /**     * <p>Gets the game action associated with the given key code of the     * device.  Returns zero if no game action is associated with this key     * code.  See <a href="#gameactions">above</a> for further discussion of     * game actions.  </p>     *     * <P>The mapping between key codes and game actions     * will not change during the execution of the application.</P>     *      * @param keyCode the key code     * @return the game action corresponding to this key, or 0 if none     * @throws IllegalArgumentException if keyCode is not a valid key code     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -