Milchreis / UiBooster

šŸš€ Creates fast and easy dialogs for utility tools
GNU General Public License v3.0
115 stars 12 forks source link

Force error, warning and info dialogs to appear in front #122

Closed nicholasveronico closed 6 months ago

nicholasveronico commented 6 months ago

This PR fixes #121, making error, warning and info "blocking" dialogs appear in front of other windows (such as a form), to allow for easier access to press "Ok" to unblock execution.

Before (having to click on the form window to bring the error to the front: https://github.com/Milchreis/UiBooster/assets/80995156/5d433a7a-8f17-4cae-bbbc-68ba6f15fe05

After (error window appears in front from the beginning): https://github.com/Milchreis/UiBooster/assets/80995156/c1c1f39e-00c8-4cd2-9b18-102aca371000

Milchreis commented 6 months ago

It seems to be a OS-specific problem. On windows and openJDK 21 I don't have this problem. I tried for my self with this test: https://github.com/Milchreis/UiBooster/blob/master/src/test/java/de/milchreis/uibooster/FormBuilderTest.java#L51

Which java do you use?

nicholasveronico commented 6 months ago

It seems to be a OS-specific problem. On windows and openJDK 21 I don't have this problem. I tried for my self with this test: https://github.com/Milchreis/UiBooster/blob/master/src/test/java/de/milchreis/uibooster/FormBuilderTest.java#L51

Which java do you use?

Iā€™m currently using Java 8

Milchreis commented 6 months ago

Ok, on Windows it works with Java 8 and 21 exactly the same. There is the info-dialog also modal by default. This seems to be different on macOS. Could you give it a try with a current Java version? I have no macOS to check this.

nicholasveronico commented 6 months ago

Ok, on Windows it works with Java 8 and 21 exactly the same. There is the info-dialog also modal by default. This seems to be different on macOS. Could you give it a try with a current Java version? I have no macOS to check this.

Yep! I tried with Java 8, 17 and 22, and all have the same problem on macOS. I guess it is an OS-specific issue.

Milchreis commented 6 months ago

Ok, thanks for trying this number of Java versions. I was curious and ran the test on an Ubuntu machine. There was a hybrid behavior of Windows and macOS. There, the info dialog appears on top of the main dialog, but when you click on the main dialog, the info dialog is moved to the background. However, the main dialog is still blocked, as in macOS.

It seems that the window management of the operating systems is very different under the hood and the JVM does not normalize it. I wasn't entirely happy with always putting the info dialogs on top, but it seems to be the easiest solution for the different operating systems.

So, thanks again for your contribution and the very collaborative work šŸ˜Š