The defn wrapping the call to proxy basically is the constructor, so you wind up with something roughly like
(defn get-window [] (let [this (proxy [Window] ["My Window!"] ; any methods you want to override on Window go here ) ; stuff making panels goes here ] (.addComponent this horizontal-panel) this)) Note, I'm calling a variable 'this' but it's *just a variable, the only reason I called it 'this' was to make it look more like the java version. On Sat Jan 31 2015 at 9:53:30 AM coco <clasesparticulares...@gmail.com> wrote: > thanks Michael this does the job...in this code, now I've other doubt > > public class MyWindow extends Window > { > > > public MyWindow() // <--- not clear where I need declare it > { > super("My Window!"); > Panel horizontalPanel = new Panel(new Border.Invisible(), > Panel.Orientation.HORIZONTAL); > Panel leftPanel = new Panel(new Border.Bevel(true), > Panel.Orientation.VERTICAL); > Panel middlePanel = new Panel(new Border.Bevel(true), > Panel.Orientation.VERTICAL); > Panel rightPanel = new Panel(new Border.Bevel(true), > Panel.Orientation.VERTICAL); > > horizontalPanel.addComponent(leftPanel); > horizontalPanel.addComponent(middlePanel); > horizontalPanel.addComponent(rightPanel); > > addComponent(horizontalPanel); // <----this is a confusing part too > } > } > > > > in this code addComponent(horizontalPanel) is basically something like > this.addComponent(horizontalPanel) > > does clojure have the "this" reference??...how can I call the > constuctor...I'm thinkingin something like this > > (defn MyWindow [] > (proxy [Window] ["My windows!!"] > (MyWindow [] (. this addComponent (Label. "Bang!!") )))) > > is it wrong no? :D > > thanks!!! > > El viernes, 30 de enero de 2015, 18:47:48 (UTC-4:30), Michael Blume > escribió: >> >> (defn my-window [] >> (proxy [Window] [])) >> >> should do the trick >> >> Proxy takes a vector of implemented interfaces and at most one superclass >> (in your case, Window), and then a second vector of arguments to pass to >> the superclass constructor (in your case, an empty vector) and then a >> series of methods implemented/overridden on the parent class/interfaces -- >> in your case there's none of those. >> >> My understanding is that proxy is not quite as performant as >> reify/defrecord, but it's the only game in town if you actually want to >> subclass something. >> >> Hope this helps =) >> >> On Fri Jan 30 2015 at 3:05:11 PM coco <clasespart...@gmail.com> wrote: >> > Hi everybody, I need implement this java code in clojure >>> >>> public class MyWindow extends Window >>> { >>> public MyWindow() >>> { >>> super("My Window!"); >>> } >>> } >>> >>> MyWindow myWindow = new MyWindow(); >>> >>> >>> unfortunately the clojure documentation for generate classes is not so >>> complete or straightforward for my understand...must I use gen-class or can >>> I use defrecord for this task?...how can I call super class >>> constructors??... >>> >>> thanks >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> >> To post to this group, send email to clo...@googlegroups.com >> >> >>> Note that posts from new members are moderated - please be patient with >>> your first post. >>> To unsubscribe from this group, send email to >>> >> clojure+u...@googlegroups.com >> >> >>> For more options, visit this group at >>> http://groups.google.com/group/clojure?hl=en >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Clojure" group. >>> >> To unsubscribe from this group and stop receiving emails from it, send an >>> email to clojure+u...@googlegroups.com. >> >> >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.