This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scala Swing in 2.7.3 compiled for 1.4

7 replies
Samuel Robert Reid
Joined: 2008-12-17,
User offline. Last seen 1 year 22 weeks ago.
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:
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
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?

Thanks,
Sam Reid
imaier
Joined: 2008-07-01,
User offline. Last seen 23 weeks 2 days ago.
Re: Scala Swing in 2.7.3 compiled for 1.4

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

Samuel Robert Reid
Joined: 2008-12-17,
User offline. Last seen 1 year 22 weeks ago.
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:
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

rytz
Joined: 2008-07-01,
User offline. Last seen 45 weeks 5 days ago.
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.
Antonio Cunei 2
Joined: 2008-12-20,
User offline. Last seen 42 years 45 weeks ago.
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
>
>

Samuel Robert Reid
Joined: 2008-12-17,
User offline. Last seen 1 year 22 weeks ago.
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
>>
>>
>

Antonio Cunei 2
Joined: 2008-12-20,
User offline. Last seen 42 years 45 weeks ago.
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

Samuel Robert Reid
Joined: 2008-12-17,
User offline. Last seen 1 year 22 weeks ago.
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
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland