views:

26

answers:

2

How to remove gap between controls in JToolBar? I want to have no free space between controls in JToolBar.

EDIT: I was wrong. There is no free space. The problem is caused by JButton (situated in JToolBar) with icon only. It has some extra margins around the icon. How to remove them?

A: 

Never tried it myself, but from reading the JavaDoc a bit I would try to things:

  1. Try to use setMargin(Insets) - It does not do what you asked for, but it might have the effect you want.
  2. Set the LayoutManager using setLayout(LayoutManager) and define the padding on the layout manager to be 0. (Perhaps a GridLayout is what you need?)
RonK
+2  A: 
aioobe