On Thu, Apr 2, 2009 at 2:33 AM, Luke VanderHart
<luke.vanderh...@gmail.com> wrote:
>
> Ugh, I hate it when I make a fool of myself and realize the answer to
> a question 1 minute after posting it, even when wrestling with it for
> an hour beforehand...
>
> The reason the example doesn't work is that the method is of a
> different arity than the one I'm attempting to call.
>
> Still doesn't explain why it's failing with the same error when I try
> to actually use it on a Swing object, but I'll try to isolate that
> condition separately... Sorry for the pointless post.

http://en.wikipedia.org/wiki/Rubber_Duck_Debugging

:)

>
> Thanks,
> -Luke
>
> On Apr 1, 8:29 pm, levand <luke.vanderh...@gmail.com> wrote:
>> Isn't this supposed to work?
>>
>> (defn create-layout []
>>     (proxy [java.awt.LayoutManager] []
>>       (addLayoutComponent [name comp]
>>                           (println "Called addLayoutComponent"))
>>       (removeLayoutComponent [comp]
>>                              (println "Called removeLayoutComponent"))
>>       (preferredLayoutSize [container]
>>                            (println "Called preferredLayoutSize"))
>>       (minimumLayoutSize [container]
>>                          (println "Called minimumLayoutSize"))
>>       (layoutContainer [container]
>>                        (println "Called layoutContainer"))))
>>
>> user> (def layout (create-layout))
>> #'user/layout
>> user> (instance? java.awt.LayoutManager layout)
>> true
>> user> (. layout preferredLayoutSize)
>> ; Evaluation aborted. java.lang.IllegalArgumentException: No matching
>> field found: preferredLayoutSize for class
>> clojure.proxy.java.lang.Object$LayoutManager (NO_SOURCE_FILE:0)
>>   [Thrown class clojure.lang.Compiler$CompilerException]
>>
>> I get the same thing for all its methods, when I try to call them
>> manually and also when I hook it up to a Swing container.
>>
>> I'd greatly appreciate it if anyone has any insight regarding what is
>> going on...
>>
>> Thanks,
>> -Luke
> >
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to