- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Scala Swing in 2.7.3 compiled for 1.4
Fri, 2009-01-16, 15:51
Scala Team,
Why is scala-swing.jar not included in scala 2.7.3 compiled for 1.4? Also, when I add the library to my 2.7.3-for-1.4 project as a JAR, this code:
Thanks,
Sam Reid
Why is scala-swing.jar not included in scala 2.7.3 compiled for 1.4? Also, when I add the library to my 2.7.3-for-1.4 project as a JAR, this code:
val button=new scala.swing.Buttoncauses this compilation error
val component:java.awt.Component=button
Error:Error:line (12)error: type mismatch;Also, my IDE seems to be ignorant of SuperMixin, used from scala.swing.Button; what is this? Is it in 2.7.3-for-1.5+ only?
found : swing.this.Button
required: awt.this.Component
val component:java.awt.Component=button
Thanks,
Sam Reid
Fri, 2009-01-16, 16:27
#2
Re: Scala Swing in 2.7.3 compiled for 1.4
>>This is expected as scala.swing.Button does not extend
java.awt.Component.
Ah, thanks, my mistake. Maybe I should use implicit conversion from scala.swing.Component to java.awt.Component, like this:
>>What IDE do you use?
I'm using IntelliJ Idea 8.0.1 with Scala plugin 0.2.21944. When I navigate to the bundled source, SuperMixin is still missed (red in the IDE), but everything seems to compile and run properly. And SuperMixin is visible from other scala.swing classes, just not in Button (maybe this problem is irrelevant for now).
Thanks again,
Sam Reid
Ingo Maier wrote:
Ah, thanks, my mistake. Maybe I should use implicit conversion from scala.swing.Component to java.awt.Component, like this:
implicit def scalaSwingToAWT(component: Component) = component.peer
>>What IDE do you use?
I'm using IntelliJ Idea 8.0.1 with Scala plugin 0.2.21944. When I navigate to the bundled source, SuperMixin is still missed (red in the IDE), but everything seems to compile and run properly. And SuperMixin is visible from other scala.swing classes, just not in Button (maybe this problem is irrelevant for now).
Thanks again,
Sam Reid
Ingo Maier wrote:
4970A1C4 [dot] 3090207 [at] epfl [dot] ch" type="cite">Samuel Robert Reid wrote:
Scala Team,
Why is scala-swing.jar not included in scala 2.7.3 compiled for 1.4?
I don't know about that, maybe Toni, Lukas?
Also, when I add the library to my 2.7.3-for-1.4 project as a JAR, this code:
val button=new scala.swing.Button
val component:java.awt.Component=button
causes this compilation error
Error:Error:line (12)error: type mismatch;
found : swing.this.Button
required: awt.this.Component
val component:java.awt.Component=button
This is expected as scala.swing.Button does not extend java.awt.Component. If you need access to the AWT Compontent, use the peer member:
val button = new scala.swing.Button
val component : java.awt.Component = button.peer
Also, my IDE seems to be ignorant of SuperMixin, used from scala.swing.Button; what is this? Is it in 2.7.3-for-1.5+ only?
That's an implementation trait that's part of scala.swing. It's not specific to any JVM version and should be there in any case. What IDE do you use?
Ingo
Thanks,
Sam Reid
Fri, 2009-01-16, 16:47
#3
Re: Scala Swing in 2.7.3 compiled for 1.4
On Fri, Jan 16, 2009 at 16:03, Ingo Maier <ingo.maier@epfl.ch> wrote:
Samuel Robert Reid wrote:
Scala Team,
Why is scala-swing.jar not included in scala 2.7.3 compiled for 1.4?
I don't know about that, maybe Toni, Lukas?
scala-swing never was shipped in the 1.4 version. However, I'm not sure if this was by an oversight or intentional.
Fri, 2009-01-16, 16:57
#4
Re: Scala Swing in 2.7.3 compiled for 1.4
Ingo Maier wrote:
> Samuel Robert Reid wrote:
>> Scala Team,
>>
>> Why is scala-swing.jar not included in scala 2.7.3 compiled for 1.4?
>
> I don't know about that, maybe Toni, Lukas?
>
Apparently the scala swing library was mistakenly never added to the build
script that creates the 1.4 package. Considering no-one even noticed until
now, I suppose there aren't many users who need this specific combination :)
We will fix this in the scripts, in case we release a possible further
2.7.x release before 2.8 comes out. In any case, the further life of 1.4 in
Scala will be very limited: the 1.4 version it is no longer supported by
Sun, and the upcoming Scala 2.8 will also be 1.5+ only.
Toni
>
>> Also, when I add the library to my 2.7.3-for-1.4 project as a JAR,
>> this code:
>>
>> val button=new scala.swing.Button
>> val component:java.awt.Component=button
>>
>> causes this compilation error
>>
>> Error:Error:line (12)error: type mismatch;
>> found : swing.this.Button
>> required: awt.this.Component
>> val component:java.awt.Component=button
>
> This is expected as scala.swing.Button does not extend
> java.awt.Component. If you need access to the AWT Compontent, use the
> peer member:
>
> val button = new scala.swing.Button
> val component : java.awt.Component = button.peer
>
>>
>> Also, my IDE seems to be ignorant of SuperMixin, used from
>> scala.swing.Button; what is this? Is it in 2.7.3-for-1.5+ only?
>
> That's an implementation trait that's part of scala.swing. It's not
> specific to any JVM version and should be there in any case. What IDE do
> you use?
>
> Ingo
>
>>
>> Thanks,
>> Sam Reid
>
>
Fri, 2009-01-16, 17:27
#5
Re: Scala Swing in 2.7.3 compiled for 1.4
>>I suppose there aren't many users who need this specific combination
My project will probably need this combination for another 6 months or
so, until we require our clients to move to Java 1.5.
>>We will fix this in the scripts, in case we release a possible
further 2.7.x release before 2.8 comes out.
Thanks for your help with this.
Sam Reid
Antonio Cunei wrote:
> Ingo Maier wrote:
>> Samuel Robert Reid wrote:
>>> Scala Team,
>>>
>>> Why is scala-swing.jar not included in scala 2.7.3 compiled for 1.4?
>>
>> I don't know about that, maybe Toni, Lukas?
>>
>
> Apparently the scala swing library was mistakenly never added to the
> build script that creates the 1.4 package. Considering no-one even
> noticed until now, I suppose there aren't many users who need this
> specific combination :)
>
> We will fix this in the scripts, in case we release a possible further
> 2.7.x release before 2.8 comes out. In any case, the further life of
> 1.4 in Scala will be very limited: the 1.4 version it is no longer
> supported by Sun, and the upcoming Scala 2.8 will also be 1.5+ only.
>
> Toni
>
>
>
>>
>>> Also, when I add the library to my 2.7.3-for-1.4 project as a JAR,
>>> this code:
>>>
>>> val button=new scala.swing.Button
>>> val component:java.awt.Component=button
>>>
>>> causes this compilation error
>>>
>>> Error:Error:line (12)error: type mismatch;
>>> found : swing.this.Button
>>> required: awt.this.Component
>>> val component:java.awt.Component=button
>>
>> This is expected as scala.swing.Button does not extend
>> java.awt.Component. If you need access to the AWT Compontent, use the
>> peer member:
>>
>> val button = new scala.swing.Button
>> val component : java.awt.Component = button.peer
>>
>>>
>>> Also, my IDE seems to be ignorant of SuperMixin, used from
>>> scala.swing.Button; what is this? Is it in 2.7.3-for-1.5+ only?
>>
>> That's an implementation trait that's part of scala.swing. It's not
>> specific to any JVM version and should be there in any case. What IDE
>> do you use?
>>
>> Ingo
>>
>>>
>>> Thanks,
>>> Sam Reid
>>
>>
>
Fri, 2009-01-16, 18:47
#6
Re: Scala Swing in 2.7.3 compiled for 1.4
Samuel Robert Reid wrote:
> >>I suppose there aren't many users who need this specific combination
>
> My project will probably need this combination for another 6 months or
> so, until we require our clients to move to Java 1.5.
>
Samuel, I prepared for you a custom 2.7.3 distribution that includes the
missing 1.4 swing support. I'll send you a download link shortly.
> Thanks for your help with this.
>
No problem :)
Toni
Sat, 2009-01-17, 23:07
#7
Re: Scala Swing in 2.7.3 compiled for 1.4
Thanks very much, I'm using the library you posted and it appears to
have the desired behavior.
Thanks again,
Sam Reid
Antonio Cunei wrote:
> Samuel Robert Reid wrote:
>> >>I suppose there aren't many users who need this specific combination
>>
>> My project will probably need this combination for another 6 months
>> or so, until we require our clients to move to Java 1.5.
>>
>
> Samuel, I prepared for you a custom 2.7.3 distribution that includes
> the missing 1.4 swing support. I'll send you a download link shortly.
>
>> Thanks for your help with this.
>>
> No problem :)
> Toni
>
Samuel Robert Reid wrote:
> Scala Team,
>
> Why is scala-swing.jar not included in scala 2.7.3 compiled for 1.4?
I don't know about that, maybe Toni, Lukas?
> Also, when I add the library to my 2.7.3-for-1.4 project as a JAR, this
> code:
>
> val button=new scala.swing.Button
> val component:java.awt.Component=button
>
> causes this compilation error
>
> Error:Error:line (12)error: type mismatch;
> found : swing.this.Button
> required: awt.this.Component
> val component:java.awt.Component=button
This is expected as scala.swing.Button does not extend
java.awt.Component. If you need access to the AWT Compontent, use the
peer member:
val button = new scala.swing.Button
val component : java.awt.Component = button.peer
>
> Also, my IDE seems to be ignorant of SuperMixin, used from
> scala.swing.Button; what is this? Is it in 2.7.3-for-1.5+ only?
That's an implementation trait that's part of scala.swing. It's not
specific to any JVM version and should be there in any case. What IDE do
you use?
Ingo
>
> Thanks,
> Sam Reid