commit 21/03/2025

This commit is contained in:
rdkartono
2025-03-24 08:10:17 +07:00
parent 093c32058c
commit 58194d8979
7 changed files with 24414 additions and 32 deletions

View File

@@ -13,6 +13,7 @@ import javafx.stage.StageStyle;
import javafx.util.Duration;
import java.util.Optional;
import java.util.function.Consumer;
public class AutoCloseAlert {
@@ -43,8 +44,9 @@ public class AutoCloseAlert {
* @param header the header of the alert
* @param content the content of the alert
* @param seconds the number of seconds before the alert is closed, or put 0 to keep it open
* @param onClose What to do after auto close
*/
public static void show(String title, String header, String content, int seconds) {
public static void show(String title, String header, String content, int seconds, Consumer<String> onClose) {
Platform.runLater(()->{
// close previous alert before showing a new one
Optional.ofNullable(currentAlertStage).ifPresent(Stage::close);
@@ -88,6 +90,7 @@ public class AutoCloseAlert {
if (currentAlertStage == alertStage) {
currentAlertStage = null;
}
if (onClose!=null) onClose.accept(shownTitle);
clear();
} );
delay.play();