[help] Basic lighting

Hi JGO!

I am currently creating a game that required lighting.
Currently i have something working but that only works with 1 light.
I tried adding more lamps using a arrayList but that failed.
What has to be changed to support multiple lights?


ArrayList<Light> lights = new ArrayList<Light>();

public void addRandomLight() { // Called on mouse-click
	try {
		lights.add(new Light(mouse.getX(), mouse.getY(), 200));
	} catch (Exception e) {}
}

public void createLightMap(Graphics g) { // Called int render (fow now, gonna split it up eventially), after rendering the map
	Graphics2D g2d = (Graphics2D) g;
	RadialGradientPaint p = null;
	for (Light l : lights) {
	    java.awt.geom.Point2D center = new java.awt.geom.Point2D.Float(l.x, l.y);
	    float radius = l.r;
	    float[] dist = {0.0f, 1.0f};
	    Color[] colors = {new Color(0.0f, 0.0f, 0.0f, 0.0f), Color.BLACK};
	    p = new RadialGradientPaint(center, radius, dist, colors);
	    g2d.setPaint(p);
	    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
	    g2d.fillRect(0, 0, 1280, 736);
	}
}