Step 2, button shows an image. I changed my code around to save the images differently, but now I'm not sure what would go in the mouseClick event to show one image once that button is clicked....
Type: Posts; User: rlo10
Step 2, button shows an image. I changed my code around to save the images differently, but now I'm not sure what would go in the mouseClick event to show one image once that button is clicked....
That's pretty much it.
User clicks a button
This button shows the image
User clicks second button
This button shows the image
If not a match, buttons will go back to showing the default image...
Haha yes, I had the idea to just flip them back over after the user goes to click the 3rd picture, but a timer would work too. I guess I have to learn to use thread right? Actually my problem now is,...
Thanks Norm, it worked!!
Ok so if I try to do something like this code, would it work better? I'm not sure what method to use do get the card to stay flipped over when it is pressed.
java.net.URL image =...
Does a different image show up on the first JButton?
That's weird. I swear it's working for me. I have 2 warnings, but no errors. I just checked the code word for word and it compiles.
Sean, I am not sure if I'm doing right. I am able to get all the backs to display correctly. I thought you could just assign another image to the JButton using the setPressedIcon() method. Is there a...
It does work, I didn't post that part of the code, I thought it wasn't important, sorry. Here is my whole layout class.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
...
Here is my output. The first button shows the phillies image, but it turns blue(in the picture) when it is clicked instead of showing the image that I designated it.
1085
So I have the backs of...
Thanks for your reply. I tried doing it this way. I have a set and get face for the card, but I'm thinking I need to change the card class to a JButton now. I extended JButton now and I tried to just...
I am making a memory card game. I created a 2D array of JButtons, size 5x6. Each button is placed on my board using a gridlayout with the same image shown when the card is face down. When the user...
OK thanks, I just got it to work!! I had too many unnecessary lines in displayBoard and I only needed 2 print statements.
I'm just a beginner and I'm not sure how to use the debugger. I don't know what variable I am supposed to be focusing on. My first step, I displayed just the numbers and they all displayed correctly....
Ok that part is fixed, here is the new output.
[1]
[1][2][3][4][5][6]
[6][7][8][9][10][11]
[11][12][13][14][15][16]
[16][17][18][19][20][21]
[21][22][23][24][25][26] ...
I would like my output to look like this...
[1][2][3][4][5]
[6][7][8][9][10]
[11] ...
I need 30 cards to be displayed. I've tried reworking some of the code but each time I always get some...
I forgot, here is the output that I get...
[1] [1]
[2]
[3]
[4]
[5]
[6] [6]
[7]
[8]
I am creating a memory card game. I want to display my board so that it looks like a 6 x 5 grid. Right now, my output has one card per line and some numbers are doubled. I figured that this has...