Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2010

    Very simple problem

    Hi forum Nokia

    I am new to programming - especially Java. I have only read "Sams Teach Yourself Java in 24 Hours" which was quite a nice introduction to Java, however it does not cover Java ME which I am currently working with. The only Java ME book I have begun reading is Beginning Java ME Platform which is not very tutorial-like as I expected. Therefore I have some simple questions to be answered, and if you happen to know any good Java ME (cldc mostly) introductory book it would be nice if you mentioned it.

    But here goes.

    I am trying to create a simple mobile application for Series 40 phones using the AGUI of NetBeans 6.8. I have managed to connect different screens to each other and add text and stuff on each of them. Now I am at a point where I would like to respond to action from the user :-)

    As and example, I would like to create a button that increases the value of a variable by 1 and then display this variable. I would like to avoid writing directly in the source code if this is in any way possible (if not I will survive anyway). Below I show some pictures of NetBeans

    Flow: http://img149.imageshack.us/f/flowp.png/
    Screen: http://img101.imageshack.us/f/screenuc.png/
    Emulator: http://img696.imageshack.us/f/emulator.png/

    As you can see it is a very basic question and I hope that you understand it. If not, then please do not hesitate to ask.

    Razga - a Java beginner.
    Last edited by Razga; 2010-12-15 at 00:57.

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    The Capital of INDIA

    Thumbs up Re: Very simple problem

    Welcome to the Forum Nokia Discussion Boards,

    Yeah you can do that, move like this.
    1. You decide that on which key you want to map the button like the Left soft key, right soft key or Fire key. Then inside the Canvas's keypressed() method you can put the condition like this,

    PHP Code:
      public void keyPressed(int keyCode) {
            if (
    keyCode == FIRE_SOFT_KEY) {
    //increase the variable by one.
                            // Call to the repaint();
    Now inside the paint(Graphics g), you draw the value of the variable and you will see this as the updated one.
    Let us know if you are not getting how to do this.
    Thanks with Regards,

    R a j - The K e r n e l

    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    Dec 2010

    Re: Very simple problem

    Thank you for the reply

    I am not quite sure how to implement your suggestion...

    When I go to the source code for the button I see this:

    PHP Code:
        public StringItem getButton() {
            if (
    Button == null) {
    // write pre-init user code here
    Button = new StringItem("Button""+1"Item.BUTTON);
    // write post-init user code here
    I am unfortunately also not that comfortable with the repaint method yet since this is my first app.

    If it is at any help, when I try to assign an action for the button I see these posibilities:

Similar Threads

  1. simple problem on my N79
    By buffon2009 in forum Mobile Java General
    Replies: 7
    Last Post: 2010-11-29, 00:56
  2. Simple Format problem
    By george2209 in forum Symbian
    Replies: 2
    Last Post: 2009-10-23, 14:06
  3. Simple app problem
    By schmrz in forum Symbian
    Replies: 4
    Last Post: 2007-12-01, 18:18
  4. simple listbox problem
    By Symbian_Neil in forum Symbian Tools & SDKs
    Replies: 15
    Last Post: 2007-04-03, 13:34
  5. Very simple Button problem
    By lilesh in forum Symbian
    Replies: 1
    Last Post: 2004-12-01, 11:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts