Changed the topPanels layout manager and configured the window so that the nameButton adapts its size relative to the windows width. Finally, this configuration works.