Hi,
My try. Not tested, though...
(defn create-toggle-shape
"Creates an ellipse that changes shape when it is clicked."
[]
(let [fIsPressed? (atom false)
shape (proxy [PPath] []
(paint
[#^PPaintContext paintContext]
(if @fIsPressed?
(doto (.getGraphics paintContext)
(.setPaint (.getPaint this))
(.fill (.getBoundReference this)))
(proxy-super paint paintContext))))]
(doto shape
(.setPathToEllipse 0 0 100 80)
(.addInputEventListener
(proxy [PBasicInputEventHandler] []
(mousePressed
[evt]
(proxy-super mousePressed evt)
(reset! fIsPressed? true)
(.repaint shape))
(mouseReleased
[evt]
(proxy-super mouseReleased evt)
(reset! fIsPressed? false)
(.repaint shape)))))))
Sincerely
Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
To unsubscribe, reply using "remove me" as the subject.