A programming assignment to illustrate a bit of threads, graphics, timers and event handlers.
  • There is one independent thread for each shape
  • Active threads are pulsating
  • From time to time, a ring shape wants to become a reader for a while and add a triangle in the center of its ring
  • From time to time, a ring shape wants to become a writer for a while and add a square in the center of its ring
  • However, there can be at most one writer at a time and there cannot be readers and writers at the same time
  • A shape that is waiting to become a reader/writer freezes and stops pulsating
  • Left click on a pulsating ring shape forces it to request a change into a reader
  • Right click on a pulsating ring shape forces it to request a change into a writer
  • To click on a reader/writer forces it to turn back into a simple ring shape
  • To click on a frozen shape does nothing
  • A middle-button click rearranges shapes randomly
(Mouse functions require Java 1.4.)
(You can also download the application lavalamp.jar.)

Michel Charpentier <>
Last modified: Mon Dec 10 13:06:42 EST 2007