javaswinglayoutborder-layoutjtoolbar

How to add gap between two buttons in JToolBar?


I need to add a simple gap/space/margin whatever to have space between these two buttons. Unfortunately I can't make it work. Could anyone give me some advice?

It's based on BorderLayout, the buttons are in a JToolBar

enter image description here


Solution

  • See JToolBar.addSeparator() which:

    Appends a separator of default size to the end of the tool bar. The default size is determined by the current look and feel.

    Or JToolBar.addSeparator(Dimension) which:

    Appends a separator of a specified size to the end of the tool bar.