Search:

Type: Posts; User: rlo10

Search: Search took 0.11 seconds.

  1. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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....
  2. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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...
  3. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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,...
  4. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    Thanks Norm, it worked!!
  5. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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 =...
  6. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    Does a different image show up on the first JButton?
  7. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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.
  8. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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...
  9. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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.*;
    ...
  10. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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...
  11. Replies
    26
    Views
    7,533

    Re: Memory Card Game JButtons Array

    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...
  12. Replies
    26
    Views
    7,533

    Memory Card Game JButtons Array

    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...
  13. Replies
    9
    Views
    1,582

    Re: Problem with Memory Card Game

    OK thanks, I just got it to work!! I had too many unnecessary lines in displayBoard and I only needed 2 print statements.
  14. Replies
    9
    Views
    1,582

    Re: Problem with Memory Card Game

    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....
  15. Replies
    9
    Views
    1,582

    Re: Problem with Memory Card Game

    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] ...
  16. Replies
    9
    Views
    1,582

    Re: Problem with Memory Card Game

    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...
  17. Replies
    9
    Views
    1,582

    Re: Problem with Memory Card Game

    I forgot, here is the output that I get...

    [1] [1]
    [2]
    [3]
    [4]
    [5]
    [6] [6]
    [7]
    [8]
  18. Replies
    9
    Views
    1,582

    Problem with Memory Card Game

    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...
Results 1 to 18 of 19