Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't figure out this out

Status
Not open for further replies.

qbasicking

Programmer
Aug 19, 2001
628
US
private void drawbulb(int dummy){
AOval cirque = new AOval(75,200,BULB_SIZE,BULB_SIZE);
if (dummy > 32){
cirque.setColor(Color.red);}
else {cirque.setColor(Color.blue);}
cirque.setToFill();
cirque.place(view);}

Why doesn't this change from red to blue when dummy is below 32? The object is drawn perfectly, except it doesn't change colour.
 
If you're expecting it to change the colour every time the variable dummy changes its value, that's not the behaviour.

That code won't change the colour, just will draw a red or blue thingie depending on the value of dummy at "drawing time".

Cheers.

Dian
 
yes, dummy changes between 0 and 100, sometimes it is below 32 and sometimes it is above 32, I need it red when it is above 32 and red otherwise, how do I do that?
 
Code:
//drawLine means within void paint method
       public void paint(Graphics g)
              {g.setColor(Color.RED);
               backg.drawLine(0,0,100,100);
              }
 
I figured it out, I don't quite understand why this happened (and neither does my prof), but it was running the same driver class from a different package.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top