我有个问题。如果我将效果设置为弹出矩形,该效果将一次又一次地应用。所以它会很厚......我该怎么办?感谢帮助!
@Override
public void start(final Stage stage) {
stage.setTitle("PopupXmpl");
BorderPane root = new BorderPane();
final Popup pop = new Popup();
Circle circle = new Circle(400, 300, 200, Color.WHITESMOKE);
circle.setStroke(Color.BLACK);
circle.setOnMouseEntered(new EventHandler<MouseEvent>(){
@Override
public void handle(MouseEvent t) {
Rectangle rectangle = new Rectangle(40, 15, Color.WHITE);
rectangle.setStroke(Color.DARKGREY);
rectangle.setArcHeight(4);
rectangle.setArcWidth(6);
pop.setHeight(100);
pop.setWidth(100);
pop.setX(t.getScreenX());
pop.setY(t.getScreenY()-50);
rectangle.setEffect(new DropShadow());
pop.getContent().add(rectangle);
pop.show(stage);
}
});
circle.setOnMouseExited(new EventHandler<MouseEvent>(){
@Override
public void handle(MouseEvent t) {
pop.hide();
}
});
root.getChildren().add(circle);
stage.setScene(new Scene(root, 800, 600));
stage.show();
}