2016-04-15 31 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