views:

20

answers:

1

How would one code the following using XGrid from JFXtras6?

Stage {
  title: "Mig Centering Test"
  scene: Scene {
    width: 200
    height: 200
    fill: Color.PINK

    content: MigLayout {
      fitParent: true
      layout: "fill"
      migContent: MigNode {
        constraints: "center"
        node: Rectangle {
          width: 100
          height: 100
        }
      }
    }
  }
}

My initial guess is that it will involve a good amount of XLayoutInfo and XGridLayoutInfo.

A: 

Turns out the answer is simple:

Stage { 
   title: "XGrid Centering Test"
   scene: XScene {
      width: 200
      height: 200
      fill: Color.PINK
      content: XGrid {
         rows: [
                 row([Rectangle {
                       height: 100
                       width: 100
                     }])
         ]
      }
   }
}
Mike Caron