ADDITIONAL SYSTEM INFORMATION :
Ubuntu 22.04.5
A DESCRIPTION OF THE PROBLEM :
If a button has a mnemonic activated (in this case there is an _ in the text and the text is parsed for a mnemonic)
and the button is in a HBox which is too small it will calculate it's bounds incorrectly.
Because the HBox is too small it will display 3 dots in the button.
But I think the bounds in the parent does take the location of the mnemonic in the original text in to consideration.
Anyway the bounding box is larger than the button itself (which can be seen when the button is selected in scenicView). The effect is that if you click UNDER the button the button will be clicked. All widgets under the bounding box will not receive the mouse clicks.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test application with the variable fixBug set to false.
Click under the button and notice that the button gets clicked (or start scenicView and select the button and notice the bounding box)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect the bounding box is equal to the space that the button occupies on the screen.
---------- BEGIN SOURCE ----------
package org.kku.jdiskusage.main;
import java.util.Arrays;
import java.util.List;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TestFx5
extends Application
{
private static boolean fixBug = false;
@Override
public void start(Stage stage) throws Exception
{
test1(stage);
}
void test1(Stage stage)
{
Scene scene;
BorderPane pane;
pane = new BorderPane();
pane.setTop(getHBox());
pane.setCenter(new Button("Press me"));
scene = new Scene(pane);
stage.setTitle("JDiskUsage");
stage.setScene(scene);
stage.show();
stage.setHeight(300);
stage.setWidth(400);
}
HBox getHBox()
{
HBox box;
List<String> list;
box = new HBox();
list = Arrays.asList("/media/kees/CubeSSD/export/hoorn", "snapshot_001_2024_08_27__11_43_19", "usr", "local",
"kees", "vault", "ECRYPTFS_FNEK_ENCRYPTED.FWahHL-b4aMey-Zzs7Wn0KzX2iNQZc.bhjjooW.7UlFj5o8ECnCeYAWQ5---",
"ECRYPTFS_FNEK_ENCRYPTED.FWahHL-b4aMey-Zzs7Wn0KzX2iNQZc.bhjjoKjwSdLYOC3fNqbJM9WGZrk--",
"ECRYPTFS_FNEK_ENCRYPTED.FWahHL-b4aMey-Zzs7Wn0KzX2iNQZc.bhjjooW.7UlFj5o8ECnCeYAWQ5---");
list.forEach(s -> {
box.getChildren().add(new MyButton(s));
});
return box;
}
private static class MyButton
extends Button
{
public MyButton(String text)
{
super(text);
System.out.println("mnemonic=" + isMnemonicParsing());
if (fixBug)
{
setMnemonicParsing(false);
}
if ("snapshot_001_2024_08_27__11_43_19".equals(text))
{
boundsInLocalProperty().addListener((o, oldValue, newValue) -> {
if (newValue.getHeight() > 100.0)
{
System.out.println("minX=" + newValue.getMinY());
System.out.println(newValue + " : bounds of " + text);
}
});
}
}
}
public static void main(String[] args)
{
launch();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The workaround is (in this case) to disable mnemonicParsing on the button.
(But this is a problem all mnemonics! not only when parsing the text)
Set the variable fixBug to true and notice that the problem is gone.
FREQUENCY : always
Ubuntu 22.04.5
A DESCRIPTION OF THE PROBLEM :
If a button has a mnemonic activated (in this case there is an _ in the text and the text is parsed for a mnemonic)
and the button is in a HBox which is too small it will calculate it's bounds incorrectly.
Because the HBox is too small it will display 3 dots in the button.
But I think the bounds in the parent does take the location of the mnemonic in the original text in to consideration.
Anyway the bounding box is larger than the button itself (which can be seen when the button is selected in scenicView). The effect is that if you click UNDER the button the button will be clicked. All widgets under the bounding box will not receive the mouse clicks.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test application with the variable fixBug set to false.
Click under the button and notice that the button gets clicked (or start scenicView and select the button and notice the bounding box)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expect the bounding box is equal to the space that the button occupies on the screen.
---------- BEGIN SOURCE ----------
package org.kku.jdiskusage.main;
import java.util.Arrays;
import java.util.List;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class TestFx5
extends Application
{
private static boolean fixBug = false;
@Override
public void start(Stage stage) throws Exception
{
test1(stage);
}
void test1(Stage stage)
{
Scene scene;
BorderPane pane;
pane = new BorderPane();
pane.setTop(getHBox());
pane.setCenter(new Button("Press me"));
scene = new Scene(pane);
stage.setTitle("JDiskUsage");
stage.setScene(scene);
stage.show();
stage.setHeight(300);
stage.setWidth(400);
}
HBox getHBox()
{
HBox box;
List<String> list;
box = new HBox();
list = Arrays.asList("/media/kees/CubeSSD/export/hoorn", "snapshot_001_2024_08_27__11_43_19", "usr", "local",
"kees", "vault", "ECRYPTFS_FNEK_ENCRYPTED.FWahHL-b4aMey-Zzs7Wn0KzX2iNQZc.bhjjooW.7UlFj5o8ECnCeYAWQ5---",
"ECRYPTFS_FNEK_ENCRYPTED.FWahHL-b4aMey-Zzs7Wn0KzX2iNQZc.bhjjoKjwSdLYOC3fNqbJM9WGZrk--",
"ECRYPTFS_FNEK_ENCRYPTED.FWahHL-b4aMey-Zzs7Wn0KzX2iNQZc.bhjjooW.7UlFj5o8ECnCeYAWQ5---");
list.forEach(s -> {
box.getChildren().add(new MyButton(s));
});
return box;
}
private static class MyButton
extends Button
{
public MyButton(String text)
{
super(text);
System.out.println("mnemonic=" + isMnemonicParsing());
if (fixBug)
{
setMnemonicParsing(false);
}
if ("snapshot_001_2024_08_27__11_43_19".equals(text))
{
boundsInLocalProperty().addListener((o, oldValue, newValue) -> {
if (newValue.getHeight() > 100.0)
{
System.out.println("minX=" + newValue.getMinY());
System.out.println(newValue + " : bounds of " + text);
}
});
}
}
}
public static void main(String[] args)
{
launch();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
The workaround is (in this case) to disable mnemonicParsing on the button.
(But this is a problem all mnemonics! not only when parsing the text)
Set the variable fixBug to true and notice that the problem is gone.
FREQUENCY : always