A DESCRIPTION OF THE PROBLEM :
The behavior of the toolbar overflow button is strange when some items depend on being added to the scene:
#1 The rightmost item is not removed even when no space to display it and the overflow is still not visible.
#2 The overflow button overlaps the rightmost visible item.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
To reproduce the bug, start the supplied application and minimize the window so that the overflow button appears.
Observe the rightmost item of the toolbar and the overflow button.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If the items cannot be displayed due to a lack of space, the overflow button should be displayed instead.
The overflow button should not overlap the items.
ACTUAL -
The rightmost item is not removed even when no space to display it and the overflow is still not visible.
The overflow button overlaps the rightmost visible item.
---------- BEGIN SOURCE ----------
public class ToolbarOverflowButton extends Application {
@Override
public void start(Stage stage) throws Exception {
ToolBar toolBar = new ToolBar();
int i = 0;
for (; i < 5; i++) {
Button b = new Button("-----");
b.setMinWidth(Region.USE_PREF_SIZE);
toolBar.getItems().add(b);
}
// This is a problematic component
Button button = new Button();
button.setMinWidth(Region.USE_PREF_SIZE);
button.sceneProperty().addListener((ov, o, n) -> button.setText(n != null ? "- XXXX -" : null));
toolBar.getItems().add(button);
for (; i < 10; i++) {
Button b = new Button("-----");
b.setMinWidth(Region.USE_PREF_SIZE);
toolBar.getItems().add(b);
}
stage.setScene(new Scene(toolBar));
stage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always
The behavior of the toolbar overflow button is strange when some items depend on being added to the scene:
#1 The rightmost item is not removed even when no space to display it and the overflow is still not visible.
#2 The overflow button overlaps the rightmost visible item.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
To reproduce the bug, start the supplied application and minimize the window so that the overflow button appears.
Observe the rightmost item of the toolbar and the overflow button.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If the items cannot be displayed due to a lack of space, the overflow button should be displayed instead.
The overflow button should not overlap the items.
ACTUAL -
The rightmost item is not removed even when no space to display it and the overflow is still not visible.
The overflow button overlaps the rightmost visible item.
---------- BEGIN SOURCE ----------
public class ToolbarOverflowButton extends Application {
@Override
public void start(Stage stage) throws Exception {
ToolBar toolBar = new ToolBar();
int i = 0;
for (; i < 5; i++) {
Button b = new Button("-----");
b.setMinWidth(Region.USE_PREF_SIZE);
toolBar.getItems().add(b);
}
// This is a problematic component
Button button = new Button();
button.setMinWidth(Region.USE_PREF_SIZE);
button.sceneProperty().addListener((ov, o, n) -> button.setText(n != null ? "- XXXX -" : null));
toolBar.getItems().add(button);
for (; i < 10; i++) {
Button b = new Button("-----");
b.setMinWidth(Region.USE_PREF_SIZE);
toolBar.getItems().add(b);
}
stage.setScene(new Scene(toolBar));
stage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always
- relates to
-
JDK-8330859 Improve focus handling in Toolbar selection item in Mac
- Open