3 Replies Latest reply: Mar 21, 2013 12:54 PM by David Grieve RSS

    Relationship between components of a Region

    Kishori Sharan
      Can someone please explain me the relationship between the following parts of a Region in JavaFX 2.0?

      Content Area
      Border Width
      Border Style (Inside, outside, ceneterd)
      Border Insets
      Margin (Yet to come)

      I am particulalry intersted in knowing how these parts affect the layoutBounds of the Region. Tried to read the API doc for Region class several times. However, I could not get the relationship between these parts clearly. Including a small example will be helpful.

        • 1. Re: Relationship between components of a Region
          Try running the demo this:
          https://gist.github.com/jewelsea/1441960 "Demo for understanding JavaFX Layout Bounds"

          Not a direct answer to your question but hopefully it aids in understanding the relationships of these concepts and it is an example (albeit not a simple one).

          Also review this presentation:
          http://www.parleys.com/#st=5&id=2734&sl=57 "Interface Layout with JavaFX 2.0" by Amy Fowler
          Particularly see the slide at 46 min and 20sec (and the following one which lets you know the useful tip that if you wrap a Node in a Group it's layoutbounds effectively becomes it's boundsInParent).

          See also the Node javadoc on bounding rectangles:
          • 2. Re: Relationship between components of a Region
            Kishori Sharan
            Thanks John. I had read/watched all these materials, before posting the question. Some wrong descriptions (Region and Border classes) in FX 8 documentation confused me. After experimenting with FX 8 code/CSS, and reading more materials on w3c.org, eveything is clear. I have filed a JIRA for changing teh FX 8 docs.

            • 3. Re: Relationship between components of a Region
              David Grieve
              It would be helpful if you could file a bug on the documentation errors that you found.