How do i animate colours only in my shapes and not everything else?

Hi i have created a game where the user clicks on the screen and where ever the user clicks triangles appear. I have created an animation whereby after the user clicks, a set of colours, green, orange cyan and cycled through 1 by 1 in the triangle. This is done with the help of a timer.

The problem i am having now is that the colours also cycle in the menue and the timer(timer is shown when the first click is pressed). I wont the colors to ONLY animate in the triangle.

Does anybody know how i can do this?

if ( m_bPing )

{

if ( m_nSeconds % 3 == 0 )

{

gc.setColor( Color.GREEN ) ;

}

elseif ( m_nSeconds % 3 == 1 )

{

gc.setColor( Color.ORANGE ) ;

}

else

{

gc.setColor(Color.CYAN);

}

}

if(m_bMouse)

{

m_Timer.start();// starts the timer from 1

m_bStart =false;

gc.drawString(" " + m_nSeconds, 7*winSize.width/8 , 7*winSize.height/10 );

for(int i = 0; i < m_nTrianglesDrawn; i++)

{

gc.fillPolygon( m_polyTriangleArr[i]);

}

}

How can i change this so that i will animate the colors in my triangle and NOT the timer and menue?

[1888 byte] By [nvidia1a] at [2007-11-26 17:09:17]
# 1
Try creating separet pannels for the menus and for the area where the triangles appear.
zkajana at 2007-7-8 23:37:06 > top of Java-index,Java Essentials,Java Programming...
# 2
He doesn't necessarily need separate panels. He just has to set the gc's color back to the original after setting the color for the triangle. Or, draw the other stuff first, then set the color for the triangle.
doremifasollatidoa at 2007-7-8 23:37:06 > top of Java-index,Java Essentials,Java Programming...
# 3
Can you perhaps give me an example, such as ensuring that the timer does not animate but making sure the triangle does?
nvidia1a at 2007-7-8 23:37:06 > top of Java-index,Java Essentials,Java Programming...
# 4
> Can you perhaps give me an example, such as ensuring> that the timer does not animate but making sure the> triangle does?Maybe it should be you who posts a *small* example program that demonstrates your problem.
DrLaszloJamfa at 2007-7-8 23:37:06 > top of Java-index,Java Essentials,Java Programming...
# 5

gc.drawString and gc.fillPolygon use the last color that was set with gc.setColor. So, you need to set the color to the correct color before calling those methods. Also, if you're using the Graphics object passed to you through a paint method, you should call g.create at the beginning of your custom drawing code and g.dispose at the end of your drawing code so that you're using a temporary Graphics object.

Jasprea at 2007-7-8 23:37:06 > top of Java-index,Java Essentials,Java Programming...
# 6
Yes i am using a graphics object , public void paint(Graphics gc). When you talk about my drawing code, i'm assuming my paint function, fill polgon code and others etc correct? Thanks, i will try that idea of yours much appreciated
nvidia1a at 2007-7-8 23:37:06 > top of Java-index,Java Essentials,Java Programming...