Commit 14042025

This commit is contained in:
2025-04-14 18:16:42 +07:00
parent fb5d143cd1
commit ca3fa0ed08
8 changed files with 153 additions and 109 deletions

View File

@@ -4,11 +4,7 @@ import javafx.animation.KeyFrame;
import javafx.animation.PauseTransition;
import javafx.animation.Timeline;
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
@@ -169,29 +165,27 @@ public class AutoCloseAlert {
int width = (int) Screen.getPrimary().getBounds().getWidth();
int height = (int) Screen.getPrimary().getBounds().getHeight();
ImageView imageView = new ImageView();
imageView.setPreserveRatio(true);
imageView.setFitWidth(width);
imageView.setFitHeight(height);
HBox hbox = new HBox();
hbox.setAlignment(Pos.CENTER);
int fitwidth = width / pictures.length;
for(Image i : pictures){
ImageView iv = new ImageView(i);
iv.setPreserveRatio(true);
iv.setFitHeight(height);
iv.setFitWidth(fitwidth);
hbox.getChildren().add(iv);
}
BorderPane borderPane = new BorderPane();
borderPane.setCenter(imageView);
borderPane.setCenter(hbox);
alertStage.setScene(new Scene(borderPane, width, height));
alertStage.centerOnScreen();
Timeline timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(0), event -> {
alertStage.show();
}));
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(0), event -> alertStage.show()));
for(int xx = 0; xx < pictures.length; xx++){
final int index = xx;
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(seconds*(index+1)), event -> {
imageView.setImage(pictures[index]);
}));
}
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(seconds* (pictures.length+1)), event -> {
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(seconds* (pictures.length)), event -> {
alertStage.close();
if (currentAlertStage == alertStage) {
currentAlertStage = null;
@@ -205,6 +199,7 @@ public class AutoCloseAlert {
shownTitle = "";
shownContent = "";
shownHeader = "";
shownBanner = null;
}
@@ -359,5 +354,6 @@ public class AutoCloseAlert {
shownTitle = "";
shownContent = "";
shownHeader = "";
shownBanner= null;
}
}