This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: Using <java.lang.Class>:forName with define-simple-class
- From: alex mitchell <lexaay at gmail dot com>
- To: Jamison Hope <jrh at theptrgroup dot com>, "kawa at sourceware dot org" <kawa at sourceware dot org>
- Date: Fri, 07 May 2010 23:30:23 +0800
- Subject: Re: Using <java.lang.Class>:forName with define-simple-class
Thanks, I'll have a look, seems like its just what I need.
Alex
On 5/7/10 10:59 PM, "Jamison Hope" <jrh@theptrgroup.com> wrote:
> On May 7, 2010, at 4:31 AM, alex mitchell wrote:
>
>> I'm trying to get a kawa-based application to be aware of MacOS
>> application
>> events such as Apple-Q, and would like to avoid having to change my
>> source
>> code when compiling on other platforms. I've got this working except
>> for one
>> problem. When I define a class implementing ApplicationAdapter as
>> follows:
>>
>> (define-simple-class <my-application-adapter>
>> (<com.apple.eawt.ApplicationAdapter>)
>> ...)
>>
>> everything works fine on a Mac, but I'm assuming I won't be able to
>> compile
>> this on non-Mac platforms, since com.apple.eawt.ApplicationAdapter
>> won't be
>> there. Instead, I've tried this:
>>
>> (define-simple-class <my-application-adapter>
>> ((<java.lang.Class>:forName
>> "com.apple.eawt.ApplicationAdapter"))
>> ...)
>>
>> However, I get an "invalid super type" compile-time error.
>>
>> I would like to be able to implement
>> com.apple.eawt.ApplicationAdapter at
>> runtime. For now I'm commenting out the line where the file
>> containing this
>> code is required when I compile, but this is not ideal.
>>
>> Anyone have any suggestions as to how to do this?
>>
>> thanks,
>> Alex
>
> Apple created a JAR of eAWT stubs specifically for the purpose of
> compiling on other platforms:
> http://developer.apple.com/mac/library/samplecode/AppleJavaExtensions/Introduc
> tion/Intro.html
>
> It hasn't been updated in a while, so there could be some missing
> features (I haven't checked). If so, file a bug report with Apple:
> https://bugreport.apple.com
>
> -Jamie
>
> --
> Jamison Hope
> The PTR Group
> www.theptrgroup.com
>
>
>