Is there a way to make certain event actions specific to left and right mouse clicks?
I’m creating a minesweeper gui, so when a square is left-clicked it will be uncovered, & when it’s right-clicked it will be flagged.
I wasn’t sure how to syntactically check for this & couldn’t find it on the tut.
Thanks for the help!
I decided to give it a go, to try to create a simple Mine Sweeper application, one without a timer or reset (yet), but that is functional and uses both a GUI cell class and a non-GUI model class (it can’t be copied and used in for intro to Java homework).
Edit 1: now has reset capability:
MineSweeper.java: holds the main method and starts the JFrame
MineCellGrid.java: the class that displays the grid of mine cells and times them all together.
MineCellGridModel.java: the non-GUI model for the MineCellGrid
MineCell.java: the class that I started on. Uses the model class as its non-GUI nucleus.
MineCellModel.java: the non-GUI model for the mine cell
Here’s the whole program combined into a single MCVE file, MineSweeper.java: