Java - Duda al cambiar el color de figuras

 
Vista:

Duda al cambiar el color de figuras

Publicado por Carlos (1 intervención) el 26/04/2017 11:32:19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
public void paint(Graphics g){
	super.paint(g);
	Graphics2D g2D = (Graphics2D) g;
	double anchoVentana = getWidth();
	double altoVentana = getHeight();
 
	if (nuev==true)
	{
		g2D.setColor(Color.WHITE);
		g2D.fill( new Rectangle2D.Double( 0, 0, anchoVentana, altoVentana ) );
		nuev=false;
		Proyecto.lapi.removeAllElements();
		Proyecto.Line.removeAllElements();
		Proyecto.Rect.removeAllElements();
		Proyecto.RectSinRelleno.removeAllElements();
		Proyecto.Elip.removeAllElements();
		Proyecto.ElipSinRelleno.removeAllElements();
		Proyecto.ventana.repaint();
	}
 
	for(int i=0; i<Proyecto.lapi.size(); i++){
 
		g2D.setPaint(col);
		g2D.fill(Proyecto.lapi.elementAt(i));
 
    }
 
	for(int i=0; i<Proyecto.Line.size(); i++){
 
		g2D.setPaint(col);
		g2D.draw(Proyecto.Line.elementAt(i));
 
    }
 
	for(int i=0; i<Proyecto.Rect.size(); i++)
	{
		g2D.setPaint(col);
		g2D.fill(Proyecto.Rect.elementAt(i));
 
	}
 
	for(int i=0; i<Proyecto.RectSinRelleno.size(); i++)
	{
		g2D.setPaint(col);
		g2D.draw(Proyecto.RectSinRelleno.elementAt(i));
 
    }
 
	for(int i=0; i<Proyecto.Elip.size(); i++)
	{
		g2D.setPaint(col);
		g2D.fill(Proyecto.Elip.elementAt(i));
 
    }
 
	for(int i=0; i<Proyecto.ElipSinRelleno.size(); i++)
	{
		g2D.setPaint(col);
		g2D.draw(Proyecto.ElipSinRelleno.elementAt(i));
 
    }
}
Hola buenas noches, estoy haciendo un programa en el cual tengo que dibujar figuras utilizando
el raton, y este debe tener una opcion COLOR que cambie el color de la siguiente figura a dibujar, el problema es
que al cambiar de color este cambia el color de todas las figura ya dibujadas, y solo ocupo que cambie el de la siguiente, alguien sabe en que estoy mal...de antemano gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder