Article View: borland.public.jbuilder.java.language
Article #15931Help! ImageControls!
From: Jennifer Latham
Date: Sat, 17 Apr 1999 00:00
Date: Sat, 17 Apr 1999 00:00
33 lines
2610 bytes
2610 bytes
I am having such difficulties with JBuilder and I would appreciate any help greatly. I am attempting to design an applet which is like the game Memory. You have "cards" (which are images that I place in ImageControls) that are initially face down, and you click on them to "flip them up" and try and match pairs. If you select an incorrect match, the cards flip back down, blah blah... My problems: Based on my experimentation, when I try to create an event for an ImageControl, it does not work. The code I place in the event does not function. As a simplistic test, I want the image to change when I click on it. When I set up my code in the ImageControl event and run it (from within the IDE) I get no change in the image. (As an aside, I know that my code does work because if I put the same code in a button event, I do get the expected image change when I click my button). If I am unable to solve this problem, a satisfactory work around would be to add buttons for each image, but I hate to do that if I don't have to. My other problem is changing the images. After two cards have been "flipped up" I would like to wait for a certain time delay (so many seconds) and turn them "back down" (change the image back to the default so the image are hidden). I have been unable to achieve this. My attempt was to create a thread, and when I wanted to create a "pause" before switching the image, I would just put my thread to sleep for so many miliseconds. In my testing, on a button click, I changed the image, executed my sleep command, then changed the image back to the original image. The result I get is that during my sleep command the ImageControl goes blank so I never see the swapped image. I have tried putting a shorter sleep increment and putting this within a for loop which also calls repaint (I have tried repainting the entire applet and the ImageControl) itself and have no success. I am begging ... for ... HELP! Please. Thank you.
Technical Details
Message-ID:
<924376620.796.56@news.remarQ.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,388ff311539b670e,start X-Google-Attributes: gidf74b3,public From: "Jennifer Latham" <jlatham@wnol.net> Subject: Help! ImageControls! Date: 1999/04/17 Message-ID: <924376620.796.56@news.remarQ.com> X-Deja-AN: 467713522 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: newsabuse@remarQ.com X-Trace: 924376620.796.56 ZZYOAESJW18ED9F8AC usenet1.supernews.com Organization: Posted via RemarQ Communities, Inc. NNTP-Posting-Date: Sat, 17 Apr 1999 19:17:00 GMT Newsgroups: borland.public.jbuilder.java.language