I am able to execute the following code to get the Style Id assigned to a variable:
public void pixelClicked(javafx.scene.input.MouseEvent event){
Object source = event.getSource();
if(source != null){
pixelIdentification = ((Node)source).getId();
}
System.out.println("PixelID is " + pixelIdentification);
System.out.println("Source is " + source);
System.out.println("Variable pixelColor is " + pixelColor);
The print out is:
PixelID is 11
Source is Circle[id=11, centerX=0.0, centerY=0.0, radius=10.0, fill=0xa9a9a9ff, stroke=0x000000ff, strokeWidth=1.0]
Variable pixelColor is 0xff0000ff
I need to also change the background color of the Object which is a Circle but after I can't get the correct code. My best idea is:
source.setFill(pixelColor);
but the error is setFill is not recognized.
Could someone explain, with the data retrieved above, what code would change the background color of the Circle Object?