×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    280

    How to change image on button on another button click

    I am working on s40 app. I have some png images with me. One of the image i have put on button(say button A) . I have another button(say button B) . I want that on clicking button B, image on first button(A) should be replaced by other png image.

    How to do this

  2. #2
    Regular Contributor
    Join Date
    Dec 2012
    Location
    India
    Posts
    271

    Re: How to change image on button on another button click

    Change the image in the action Listener of the first Button and repaint the second button to update the change.

    Code:
    Button A = new Button();
    Button B = new Button();
    
    Image firstImage,secondImage;
    //Initialize the two images
    ...
    B.setIcon(firstImage);
            A.addActionListener(new ActionListener() {
    
                public void actionPerformed(ActionEvent evt) {
                               B.setIcon(secondImage);
                               B.repaint();
                }
            });

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    280

    Re: How to change image on button on another button click

    Thanks arunkam

Similar Threads

  1. Download wallpaer (.jpg image file) on button click.
    By DanSiddiqui in forum Nokia Asha Web Apps
    Replies: 5
    Last Post: 2011-08-19, 10:01
  2. click on button and radio button
    By videoFx in forum [Archived] Flash Lite on Nokia Devices
    Replies: 1
    Last Post: 2009-10-22, 23:29
  3. Replies: 4
    Last Post: 2007-11-22, 11:11

Posting Permissions

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