![]() ![]() These are two methods in Board Class: setCellValues() and scanForEmptåells(). I wonder if my solution is reasonable (it works, but it look scary), and I would be great, if someone would review it. The hardest part for me, was a determining the value of single cells (how many mines is around it), and firing a chain reaction, if some cell was empty(value = 0) - it check closest cells, if they have value, it just reveal it, if they are empty it repeats process on them. Board - coordinating behavior of cells.Cell - controling behavior of single cell.Thanks in advance for any help you guys give! I'm going to class, so it could take me a bit to respond.I wrote a basic Minesweeper game for practice. Minefield.addMouseListener(new MouseHandler()) It works fine but I'm open to suggestions on a better way to do this. This builds the "Minefield" with a ROWS*COLUMNS amount of buttons. Private class MouseHandler extends MouseAdapter I'm guessing I shouldn't have used a for loop, but I don't or an F, eventually this will reveal what the value of the button is This is supposed to change the JButton that is clicked on to either a T Assigns a JButton the value of true or false, which represents whether or not it Removes one from the total number of mines. ![]() I will eventually want to create a menu, but it's extra credit so I'm going to Can I have some pointers on how to do this? import javax.swing.* When I click a button, it changes every button on the screen instead of just the one I clicked. I have to make a Minesweeper GUI, but I cannot figure out how to make each button have it's own mouseAdapter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |