开发者

Extending a Java Swing class in Clojure

开发者 https://www.devze.com 2023-01-01 15:49 出处:网络
I\'m trying to extend a Java Swi开发者_运维问答ng component in Clojure, i.e. I want to extend a javax.swing.JComponent and add some custom methods implemented in pure Clojure in addition to all the st

I'm trying to extend a Java Swi开发者_运维问答ng component in Clojure, i.e. I want to extend a javax.swing.JComponent and add some custom methods implemented in pure Clojure in addition to all the standard inherited methods.

I've tried using "proxy" which works great if I just want a single instance (in the same way as an anonymous inner class). However I'd really like a named class so that I can generate an arbitrary number of instances.

What's the recommended way of doing this?


Use gen-class (note that you can use it as an in-line function or in the namespace declaration).

(gen-class :extends javax.swing.JComponent ...)
0

精彩评论

暂无评论...
验证码 换一张
取 消