public void checkNeedMenu(JPanel panel, List<TabButton> tabs, TabButtonMenu menuTab){
        boolean tabOutScreen = false;
        int lastVisibleIndex = (getWidth()+TOTAL_BUTTON_WIDTH/2)/TOTAL_BUTTON_WIDTH - 1;
        
        for(TabButton tab : tabs){
            if(tab.data.index > lastVisibleIndex){
                tabOutScreen = true;
                break;
            }
        }
        
        if(tabOutScreen){
            List<TabButton> outScreenTabs = new ArrayList<TabButton>();
            
            for(TabButton tab : tabs){
                if(tab.data.index >= lastVisibleIndex){
                    outScreenTabs.add(tab);
                    panel.remove(tab);
                }
            }
            menuTab.data.index = lastVisibleIndex;
            menuTab.setLocation(menuTab.data.index*TOTAL_BUTTON_WIDTH+4, menuTab.getLocation().y);
            menuTab.visible = true;
            panel.add(menuTab);
            menuTab.refresh(outScreenTabs);
        }
        else{
            menuTab.visible = false;
            panel.remove(menuTab);
            menuTab.refresh(null);
        }
    }