I'm trying to use Swing from Clojure, and I'm getting confused by gen-class
and I can't tell from the documentation if this is supposed to work - paintComponent
is a protected method on JPanel
, and I'm able to override it, but when I try to call the exposed superclass's method, I get java.lang.IllegalArgumentException: No matching method found: parentPaintComponent for class project.PicturePanel
. Can anyone clarify why I don't seem to have access to this method?
(ns project.PicturePanel
(:gen-class
:extends javax.swing.JPanel
:name project.PicturePanel
:exposes-methods {paintComponent parentPaintComponent}))
(defn -paintComponent [this g]
(println this)
(println g)
(.parentPaintComponent this g))
Yes! The code works correctly if you make sure that your compiled .class files are up to date. Try recompiling them!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With