@Override public void paint(Graphics g) { super.paint(g); for (Ball b : ballsList) { g.setColor(b.getColor()); g.fillOval(b.getX(), b.getY(), b.getSize(), b.getSize()); b.move(getWidth(), getHeight()); } }
public void paintComponent(Graphics g) { super.paintComponent(g); if (!t.isRunning()) { t.start(); } this.detectCollitions(); for (Ball i : b) { int[] oval = i.getOval(); i.move(); g.fillOval(oval[0], oval[1], oval[2], oval[3]); } }