Results 1 to 3 of 3
  1. #1
    ntagrafix's Avatar
    ntagrafix is offline Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    29
    Rep Power
    0

    Question How to swap to images on clicks

    Hi all,

    I have to images; 1.jpg and 2.jpg of the same size. Now i want to swap between the two images any time user clicks on it like a toggle.

    How do i do this in NetBeans 6.7.1 JFrame form?

    I tries using the JToggleButton but didn't work .


    thanks
    Life is not perfect, but the way you live it can make it perfectly wongerful :cool:

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,233
    Rep Power
    6

    Default

    Use the setIcon(...) method to change the icon on every mousePressed event.

  3. #3
    ntagrafix's Avatar
    ntagrafix is offline Member
    Join Date
    Nov 2009
    Location
    Denmark
    Posts
    29
    Rep Power
    0

    Thumbs up cool

    thanks it work fine for me..:cool::)
    Life is not perfect, but the way you live it can make it perfectly wongerful :cool:

Similar Threads

  1. swap two frames on user click
    By marodia in forum AWT / Swing
    Replies: 1
    Last Post: 08-25-2009, 09:11 AM
  2. [SOLVED] Intercepting mouse clicks
    By carderne in forum New To Java
    Replies: 6
    Last Post: 02-28-2009, 07:10 PM
  3. Question about CAS (compare and swap) method
    By illidian in forum Advanced Java
    Replies: 1
    Last Post: 04-04-2008, 08:49 PM
  4. code for number of clicks clicked on a web page???
    By Sveta_cool in forum Advanced Java
    Replies: 2
    Last Post: 02-01-2008, 02:55 PM
  5. how to swap 2 numbers
    By mary in forum Advanced Java
    Replies: 1
    Last Post: 08-02-2007, 05:32 PM

Posting Permissions

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