Java - Change the color of some squares created with Graphics2D
问题 I just want to create a simple game with 100 x 100 square, each square is 5 pixels. I created a class: public class Draw extends JComponent{ private List<Graphics2D> recList = new ArrayList<Graphics2D>(); public void paint(Graphics g) { //THIS TO SET (0,0) PANEL START AT BOTTOM LEFT Graphics2D g2 = (Graphics2D)g; AffineTransform at = g2.getTransform(); at.translate(0, getHeight()); at.scale(1, -1); g2.setTransform(at); //THIS TO DRAW ALL THE SQUARES for (int i = 0;i<100;i++){ for (int j=0;j