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

[Swing] Question related to implicit

2 replies
Rodrigo Cano
Joined: 2009-03-22,
User offline. Last seen 42 years 45 weeks ago.
Hi all,

I want to specify the size of a component like this:

preferredSize = (300, 300)

but the compiler warns about it being deprecated, and recommends me to use the implicit in Swing object. Now, how do I use it?, because just importing Swing._ doesn't work, I mean, the compiler still assumes I am calling the tuple version instead of the Dimension version using implicits. So how do I use the implicit?, like this maybe?:

preferredSize = (300, 300): Dimension

but that would be almost like

preferredSize = new Dimension(300, 300)

which totally kills the purpose. All help is welcomed :)

Cheers.
Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: [Swing] Question related to implicit
This was discussed. I think a bug was (supposed to be?) filed for it.

On Thu, Apr 15, 2010 at 10:16 AM, Rodrigo Cano <ioniviil [at] gmail [dot] com> wrote:
Hi all,

I want to specify the size of a component like this:

preferredSize = (300, 300)

but the compiler warns about it being deprecated, and recommends me to use the implicit in Swing object. Now, how do I use it?, because just importing Swing._ doesn't work, I mean, the compiler still assumes I am calling the tuple version instead of the Dimension version using implicits. So how do I use the implicit?, like this maybe?:

preferredSize = (300, 300): Dimension

but that would be almost like

preferredSize = new Dimension(300, 300)

which totally kills the purpose. All help is welcomed :)

Cheers.

Rodrigo Cano
Joined: 2009-03-22,
User offline. Last seen 42 years 45 weeks ago.
Re: [Swing] Question related to implicit
Ok, thanks.

On Thu, Apr 15, 2010 at 4:55 PM, Naftoli Gugenheim <naftoligug [at] gmail [dot] com> wrote:
This was discussed. I think a bug was (supposed to be?) filed for it.

On Thu, Apr 15, 2010 at 10:16 AM, Rodrigo Cano <ioniviil [at] gmail [dot] com> wrote:
Hi all,

I want to specify the size of a component like this:

preferredSize = (300, 300)

but the compiler warns about it being deprecated, and recommends me to use the implicit in Swing object. Now, how do I use it?, because just importing Swing._ doesn't work, I mean, the compiler still assumes I am calling the tuple version instead of the Dimension version using implicits. So how do I use the implicit?, like this maybe?:

preferredSize = (300, 300): Dimension

but that would be almost like

preferredSize = new Dimension(300, 300)

which totally kills the purpose. All help is welcomed :)

Cheers.


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