RSS Forums RSS
Please support our Java advertiser: Lunarpages Java Web Hosting

changing colours

Join Date: Aug 2004
Location: Hanover
Posts: 152
Reputation: cosi is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 1
cosi's Avatar
cosi cosi is offline Offline
Junior Poster

Re: changing colours

  #4  
Aug 12th, 2004
This should go in your paint function or any function for which you have a Graphics object available.

public void paint(Graphics g) {

    // your class colors... by the way,  this is not java
    // convention to lower case class names.  Should be Colors
    colors colorChooser = new colors();
  
    Color c = colorChooser.decide(A[i])
    g.setColor(c);
    // Color is now set :-)

    // now you can g.drawRect(....) with the correct color.
}

See my post here if you want to know how to use loops to step through your array.
http://www.daniweb.com/techtalkforum...ead.php?t=9203


Hope this helps!

Ed
Reply With Quote  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:41 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC