aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes average of colour Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "average of colour" Watch "average of colour" New topic
Author

average of colour

Isaac Hewitt
Ranch Hand

Joined: Jul 24, 2006
Posts: 190

Hi all,

I have a JWindow which serves as a note background. I am using a palette of colours for the background that range from black to white. I need to calculate the colour average so as to choose whether white of black text is to be used over the background. So if the background is black, white text will be used.

Right now I am using a very archaic way of doing this by having an array list of named colours fill up at program startup. I chose all dark colours for the list, or the ones on which white text would be visible. Depending on the colour chosen by the user, white or black text is selected.



Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36478
    
  16
I think this thread would sit better on the Swing forum . . . moving.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9990
    
    7

You had a question?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: average of colour
 
Similar Threads
need to make the text cursor white in a black text editor
is it an array i need?
Random to the colour object
ColorTable Array!!
Images in a JTable