                                   {}
                                   methods)]
     (update-proxy prx bound-meths)
-    (applet-run prx)
+    (applet-run prx mode)
     prx))
 
 (defmacro defapplet

                                  :mouse-released :mouse-moved :mouse-dragged
                                  :focus-gained :focus-lost :mouse-entered
                                  :mouse-exited :mouse-clicked :setup)
        fns               (merge {:draw (fn [] nil)} fns)
        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))
        mouse-pressed-fn  (or (:mouse-pressed options) (fn [] nil))
        mouse-released-fn (or (:mouse-released options) (fn [] nil))
        mouse-moved-fn    (or (:mouse-moved options) (fn [] nil))

                      JFrame/EXIT_ON_CLOSE
                      JFrame/DISPOSE_ON_CLOSE)]
       (reset! (:frame m)
               (let [f (JFrame. (or (:title m) "Processing-core"))]
                 (doto f
                   (.addWindowListener  (reify WindowListener
                                          (windowActivated [this e])
                                          (windowClosing [this e]
                                            (future (applet-close applet)))
                                          (windowDeactivated [this e])
                                          (windowDeiconified [this e])
                                          (windowIconified [this e])
                                          (windowOpened [this e])
                                          (windowClosed [this e])))
                   (.setDefaultCloseOperation close-op)
                   (.setSize width height)
                   (.add applet)
                   (.pack))
                 (when (= mode :opengl)
                   (.setResizable f false))
                 (.show f))))))

(def ^{:private true}
  renderer-modes {:p2d    P2D
