-
Notifications
You must be signed in to change notification settings - Fork 145
Alert
boxes are broken on Linux.
#222
Comments
I have same problem , that i resolved using:
Platform.runLater(() -> myStage.sizeToScene());
Em qua, 26 de set de 2018 14:42, Daniel Ziltener <notifications@github.com>
escreveu:
… This happens with both OpenJDK 10 & 11 with OpenJFX from Maven on Linux.
More often than not, it turns out like this:
[image: The alert window] <https://i.stack.imgur.com/dsT73.png>
I tried setMinWidth and setMinHeight, but these seem to make no
difference at all. My code:
Alert alert = new Alert(AlertType/INFORMATION);
alert.setTitle("Testtitle");
alert.setContentText("Some example content text for an alert box.");
alert.setMinHeight(Region.USE_PREF_SIZE);
alert.setMinWidth(Region.USE_PREF_SIZE);
alert.showAndWait();
This is being run on the JavaFX application thread. The application is
running on OpenSUSE Tumbleweed with KDE Plasma.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#222>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AA6BsiQ8ePaBheliHLWY5DkE2C4ED5Awks5ue7yXgaJpZM4W7KcH>
.
|
Okay. Where is |
I can confirm this problem. It also happens on dialogs that extends Dialog. I reported this issue a while back. https://bugs.openjdk.java.net/browse/JDK-8179073 |
I try to reproduce the problem, but it works for me on Ubuntu 18.04
|
Platform.runLater(() -> { |
Im using Manjaro Kde/Plasma, this is kind a random problem, i never know when will happen.So to prevent i ever call sizeToScene on separated thread from the stage that i want to show. |
This seems to fix it, thank you! I think it is a bug that OpenJFX doesn't do this automatically in |
Yes, the above is a workaround for what looks like a platform-specific bug in JavaFX. FX already does size the scene automatically before showing it. For some reason it seems this isn't working on Linux in all cases (maybe it depends on the Window manager) |
Correction: no, it doesn't fix it, unfortunately. I still get the same problem. I just had a bit of luck two times in a row... |
I had a strange message from kernel, while running a simple test: |
This message is not related with javafx, but with driver of my Radeon, i fixed it, and test with 3 diferent drivers: Vesa, Catalyst and Amdgpu(actual), i still get the same problem with alerts. |
I think it's a KDE problem, Alerts work fine if i switched my desktop environment to XFCE. |
It's not a KDE problem when
|
Hi |
Hello |
CompiledLibs.zip If you are using ArchLinux 64bit, maybe you can test. |
Confirming this from KDE + ArchLinux. this.resizable = true
this.onShown = {
Platform.runLater {
this.resizable = false
}
} Note that I'm using groovy, you can easily translate this into java and it will have the same effect. This does keep the pane large consistently, however at times it will stay resizable, which seems like an entirely different bug. |
Yes i can confirm that your workaround fix the problem, but as you say, the alert stay resizable. |
My changes on modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp, fixed the problem on Arch Kde\Gtk, but on Arch Gnome, cause and old bug that was fixed, bug that dont show de maximize button. I think that a simple solution is test if we are using kde. |
One solution is test if running on kde: |
What you think about that? |
I'm having this problem too, also using KDE/Plasma 5. |
Doesn't that just test if your current desktop starts with a K? |
I think that they fixed this bug here: |
Now I have experienced this problem with JavaFX 8. Running Oracle JDK 8u212. Reverting back to JDK 8u181 I don't get this problem. I was hoping this was solved when we where going to move from Java 8 to Java 11, but now I have no choice to find and use a workaround sizeToScene(). |
I can't replicate this bug on Java FX 13 Early-Access. Manjaro KDE 18.0.4 |
As long as the bugfix will be backported to at least JavaFX 11. |
javafxports/openjdk-jfx#222 Problem displaying dialogs in Linux with OpenJDK and KDE.
On JavaFX 11.0.2, you can solve this problem with this code : alert.setOnShowing(new EventHandler<DialogEvent>() {
@Override public void handle(DialogEvent e) {
new Thread(new Runnable() {
@Override public void run() {
try{
Thread.sleep(200); // You can change this value if is not working sometimes
}catch(InterruptedException ex){ ex.printStackTrace(); }
Platform.runLater(new Runnable(){
@Override public void run(){
if(alert.getDialogPane().getScene().getWindow().getWidth() < 100){
alert.getDialogPane().getScene().getWindow().setWidth(500);
alert.getDialogPane().getScene().getWindow().setHeight(200);
// You can edit this two values
}
}
});
}
}, "AlertResizer").start();
}
}); |
The question of whether to backport JDK-8193502 is being discussed on the openjfx-dev mailing list in this thread. |
For Kotlin a wrote an extension function, that uses coroutines to workaround the problem: fun <T> Dialog<T>.disableResizing() {
isResizable = true
onShown = EventHandler {
GlobalScope.launch {
delay(1)
Platform.runLater {
isResizable = false
}
}
}
} Works in a similar way for disabling stage resize: fun Stage.disableResizing() {
isResizable = true
onShown = EventHandler {
GlobalScope.launch {
delay(1)
Platform.runLater {
isResizable = false
}
}
}
} Just in case someone needs a working solution. |
Now 'About' window is a scene, instead of using 'Alerts'. 'Alert' boxes are broken on Linux: * javafxports/openjdk-jfx#222 * https://bugs.openjdk.java.net/browse/JDK-8179073 * https://stackoverflow.com/q/28937392
… within a different Thread e.g. a Service Thread for Services that need a user input during execution.; GUI: Added a workaround for bug #222, see javafxports/openjdk-jfx#222
This happens with both OpenJDK 10 & 11 with OpenJFX from Maven on Linux. More often than not, it turns out like this:
I tried
setMinWidth
andsetMinHeight
, but these seem to make no difference at all. My code:This is being run on the JavaFX application thread. The application is running on OpenSUSE Tumbleweed with KDE Plasma.
The text was updated successfully, but these errors were encountered: