scala for yield setting a value

Posted by coubeatczech on Stack Overflow See other posts from Stack Overflow or by coubeatczech
Published on 2010-03-24T00:58:19Z Indexed on 2010/03/24 1:03 UTC
Read the original article Hit count: 376

Filed under:
|
|

Hi, I want to create a list of GridBagPanel.Constraints. I read it in the scala programming book, that there is a cool for-yield construction, but I probably haven't understood the way it works correctly, because my code doesn't compile. Here it is:

        val d = for {
            i <- 0 until 4
            j <- 0 until 4
        } yield {
            c = new Constraints
            c.gridx = j
            c.gridy = i
        }

I want to generate a List[Constraints] and for every constraint set different x,y values so later, when I later add the components, they're going to be in a grid.

© Stack Overflow or respective owner

Related posts about scala

Related posts about swing