So I'm making a game, in which the player plays a card (by clicking the button associated with that card) to add a piece to the board in a new square.
I have this piece of code to draw the board:
which works fine, but I can't figure out how to actually get the NEW pieces drawn on the board.
In Head First Java, there's an example where you push a button to randomly change the color of a circle, but all it does is call a repaint on the whole frame - because the color picking code is actually inside the paintComponent method, it works fine for that purpose. What I'm trying to do is add something that wasn't there previously.
I tried to add a second method to the class (additions in bold):
but it doesn't work because g is out of scope for the addCrown method.
Can anyone point me in the right direction on this?