1

I am using ControlFX library in my project to generate forms dynamicly using PropertySheet. Controllor class:

    public class Controllor implements Initializable
   {
    @FXML
    private PropertySheet sheet;
    @Override
    public void initialize(URL location, ResourceBundle resources)
    {
    sheet = new PropertySheet(BeanPropertyUtils.getProperties(new BeanObj(someProperties)));
    sheet.setMode(PropertySheet.Mode.NAME);
    }
    }

My fxml file contains an AnchorPane and PropertySheet (just for testing).
The program runs with no errors but it shows an empty propertySheet control!
So , am I doing this right? Please any help would be appreciated !!
EDIT: I manage to get the application running by implementing the same code in the Start() method of the MainClass
I am still confused !! I can't figure it out...
EDIT 2: F5 solve everything to me

Community
  • 1
  • 1
MontaWiso
  • 99
  • 1
  • 1
  • 7

1 Answers1

0

You were creating a second instance of sheet, but without being added to the scene graph.

With the @FXML annotation, the FXMLLoader created one that was the one added, but without content or elements.

This should work:

@FXML
private PropertySheet sheet;

public void initialize() {
    sheet.getItems().setAll(BeanPropertyUtils.getProperties(new BeanObj()));
    sheet.setMode(PropertySheet.Mode.NAME);
}
José Pereda
  • 44,311
  • 7
  • 104
  • 132
  • I am using eclipse and scene builder, for some reason fxml files were not (syncing) in eclipse!! that's why I kept getting error and empty scene !!! . F5 solved the problem !!! thanks anyway – MontaWiso Apr 09 '16 at 23:24