Get something like overflow-Event


i am trying to set up a Button bar which does not have a specific with.
It is set to 100% by the parent component.
Now i have somethin like a bar of buttons where multiple buttons are added,
but at some point the buttons will ether overflow or there will be a scrollbar, but i would like to have another solution where a button pops up to show “more buttons availible” and no overflow and no scrollbar should be visible.
But can’t find any resources on that one.

Here is a quick example:

ButtonBar bar = new ButtonBar();
//add some buttons

public class ButtonBar extends VerticalLayout{
    private ArrayList<Button> someMore;
    private Button moreButtons;
    public ButtonBar(){
        someMore = new ArrayListButton<>();
        moreButtons.addClickListener(new ClickListener() {
            public void buttonClick(ClickEvent event) {
                //show smoeMore Buttons in something like a dropdown
    public void addButton(Button btn){
        boolean doesFitInLayout = ???;
            addComponent(btn, getComponentCount()-1);

[/code]Thanks for your help and ideas

greetings Michael


You could use the MenuBar component, which does exactly this (collapses the options that do not fit in the layout to a dropdown. Resize the browser to see it happen:!menubars

Thats quite a good idea - i will give this a try.
Thanks you.