Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6689723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:33:10+00:00 2026-05-26T05:33:10+00:00

Hello I’m writing simple j2me calculator. using GameCanvas class as a basis of my

  • 0

Hello
I’m writing simple j2me calculator. using GameCanvas class as a basis of my interface. I need to handle both numpad key events and game-relaited events (such as UP, DOWN, FIRE, etc) for moving my cursor. The problem is that neither emulator, nor my Sony Ericsson doesn’t receives some numpad and game-relaited events. For example, I get SOFT1, SEND, 2, 4, ASTERISK key pressed events, but don’t receive 1, 3, LEFT, RIGH, UP, DOWN, FIRE events.

class CalculatorCanvas extends GameCanvas
{
    public CalculatorCanvas() throws java.io.IOException
    {
        super(true);
        setFullScreenMode(true);

        cursor = new Sprite(Image.createImage("/cursor.png"));
    }

    public void paint(Graphics g)
    {
        g.setColor(0);
        g.fillRect(0, 0, getWidth(), getHeight());
        cursor.paint(g);
    }

    protected void keyPressed(int keyCode)
    {
        System.out.println("keyPressed: " + getKeyName(key));
        if (keyCode == getKeyCode(RIGHT))
            cursor.move(STEP, 0);
        if (key == getKeyCode(LEFT))
            cursor.move(-STEP, 0);
            /*...*/
        repaint();
    }

    private final int STEP = 3;
    private Sprite cursor;
}  

How can I receive all this events?
Thanks in advance

PS I’ve found that Canvas (base class for GameCanvas) reseives all this events, but I have to use GameCanvas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:33:10+00:00Added an answer on May 26, 2026 at 5:33 am

    check javadoc for GameCanvas constructor. You should call it with “false” !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello ! I need to create a report like the attachment shows with Jasper
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
hello for my app I need to save a record that the user type,
Hello guys i have been using JavaFx scene builder to build a gui that
Hello i need to gater the data from db(MSSQL) in following way: <div id=slider>
Hello I am using jQuery UI Accodions By default, the first accordion is shown
Hello I'm making RSS reader and I'm using DOM. Now I stuck, trying to
Hello all and thanks for your time reading this. I need to verify certificates
Hello again; i need to show X,Y,Risk in ListBoxes. But i can not do
Hello all and thanks for the attention! I have a problem that must both

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.