                               (apply applet-set-size size-vec))
                             (when-let [f (:setup options)]
                               (f)))
-        methods           (into {} (map fix-mname fns))
         frame             (atom nil)
         state             (atom nil)
         keep-on-top?      (atom (:keep-on-top options))

  toupper (memfn toUpperCase))

(defonce untitled-applet-id* (atom 0))

(defn- fix-mname
  "Changes :method-name to :methodName."
  [[mname fun]]
  (let [mname (name mname)
        mr (re-matcher #"\-[a-zA-z]" mname)
        replace-fn (comp #(.replaceFirst mr %) toupper #(.substring % 1))
        fixed-name (if-let [matched (re-find mr)]
                     (replace-fn matched)
                     mname)]
    [(keyword fixed-name) fun]))


(defn applet-stop
  "Stop an applet"

  (let [options           (merge {:size [500 300]} (apply hash-map opts))
        size              (validate-size! (:size options))
        renderer          (or (:renderer options) :p2d)
        draw-fn           (or (:draw options) (fn [] nil))
        setup-fn          (or (:setup options) (fn [] nil))
        key-pressed-fn    (or (:key-pressed options) (fn [] nil))
        key-released-fn   (or (:key-released options) (fn [] nil))
        key-typed-fn      (or (:key-typed options) (fn [] nil))
