Forums Register Login

Pixel Listener

+Pie Number of slices to send: Send
hey,

i want to create a program that is reacting on some pixels and is increasing a counter when a selected pixel is changed. Im using the Robot class for it. cause this:

is killing my pc, i am looking for another way. I guess its possible with listeners. but i got no idea how. any solutions?
+Pie Number of slices to send: Send
David,
This is the java.awt.Robot class, right? It doesn't have listeners because it is designed largely for triggering events. You could add a Thread.sleep to your loop and have it check only once a second. A listener would be better though. I'll add this to the AWT forum as well.
+Pie Number of slices to send: Send
Yes. I am looking for some other ways to solve my problem (creating a program that is increasing a counter whenever a selected pixel is changing his color).

Thank you for moving!
+Pie Number of slices to send: Send
 

I guess its possible with listeners.



I'm not aware of any such listener.

whenever a selected pixel is changing his color



Why does the pixel change its color? Is this something your program is doing?

Pixels don't just randomly change there color unless your program is doing some process. So I'm guessing a better solution (to reduce CPU usage) is to track the pixel color before and after the processing your program is doing.
+Pie Number of slices to send: Send
If another program is changing the color at that location, you can have your program check it periodically.  Less time spent sleeping between checks will use more CPU.
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 461 times.
Similar Threads
Whizlabs Question on Operators&Assignments
Equals Method problem
Overriding .equal method to compare between 2 objects (user defined classes)
Operators
Polymorfism. Dynamic binding. Invoking wrong method.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:38:22.