/** * Paints the screen on a graphics context * * @param g the graphics context to paint on */ protected void paintComponent(Graphics g) { super.paintComponent(g); // draw all piles and the remaining cards left in the deck for (int i = 0; i < mainPiles.length; i++) { mainPiles[i].draw(g); } for (int i = 0; i < suitPiles.length; i++) { suitPiles[i].draw(g); } deckPile.draw(g); deck.draw(g); if (selectedPile != null) { selectedPile.draw(g); } }