2 Replies Latest reply: Aug 21, 2013 10:35 AM by user8929955 RSS

    Control insets in JavaFX 2.2

    user8929955

      With JavaFX 8 the control has a property holding the padding. How can I retrieve the insets with JavaFX 2.2? I need them to calculate the content area. If I do not take them into account, they are ignored, which is not what I intend to do.

        • 1. Re: Control insets in JavaFX 2.2
          bouye

          Only things that inherit from Region have a getInsets() and a getPadding() method. Except for that, the usage of the Insets class is limited.

          It works in FX8 because they changed the inheritance tree of the controls.

          i.e:

           

          in JavaFX 2.2, controls did not inherit from Region:

          • java.lang.Object
            • javafx.scene.Node
              • javafx.scene.Parent
                • javafx.scene.control.Control
                  • javafx.scene.control.Labeled
                    • javafx.scene.control.ButtonBase
                      • javafx.scene.control.CheckBox

           

          In JavaFX 8, they do inherit from Region:

          • java.lang.Object
            • javafx.scene.Node
              • javafx.scene.Parent
                • javafx.scene.layout.Region
                  • javafx.scene.control.Control
                    • javafx.scene.control.Labeled
                      • javafx.scene.control.ButtonBase
                        • javafx.scene.control.CheckBox
          • 2. Re: Control insets in JavaFX 2.2
            user8929955

            So what it basically boils down, I have to define a property of my own and cannot access the padding defined through CSS. Not such a nice solution, but a working one.

            When migrating to JavaFX 8 I will consider the impact, that my non resizeable Control becomes resizable.