0

I have a guicontroller class which shows a black circle. And I've made this method inside that guicontroller class to change the color of the circle. Object light is a Circle.

public void getLight(){
    light.setFill(Color.RED);
}

When I call this function from a different class with the use of:

guicontroller ctrl = new guicontroller();

ctrl.getLight();

nothing happens in my gui, it calls the getLight() method but does not fill the circle.

Kuja
  • 449
  • 6
  • 20
  • what kind of an object is light? – Daniel Cook Mar 03 '16 at 03:26
  • where's your Graphics object? you need to to do g.fill(light) at some point to have it show up. – Daniel Cook Mar 03 '16 at 03:39
  • I've used an fxml file and filled it there. – Kuja Mar 03 '16 at 03:46
  • You're creating a new controller instance and calling the method on that. The `light` field in that instance is not part of your scene graph. You need to get the controller instance from the `FXMLLoader` when you load and display the fxml, and call the method on that instance. – James_D Mar 03 '16 at 10:56

0 Answers0