2016-04-15 67 views

回答

1

您可以使用節點快照來做到這一點:

// create any shape you want (e.g. circle) 
// set fill to null 
Circle circle = new Circle(32, null); 

// set stroke to required color 
circle.setStroke(Color.BLACK); 

// this is needed to 'cut' the fill from snapshot 
SnapshotParameters sp = new SnapshotParameters(); 
sp.setFill(Color.TRANSPARENT); 

// perform snapshot of the shape into an image 
Image image = circle.snapshot(sp, null); 

// set cursor from that image 
scene.setCursor(new ImageCursor(image, 16, 16)); 
+0

非常感謝,它的工作:) – Madalina