devxlogo

Square Buttons in the JToolBar

Square Buttons in the JToolBar

When placing JButtons in the JToolBar, use gif icons that are 25 x 25 pixels. Then create a ToolButton class that sets the insets to zero so that the buttons are square instead of rectangular:

 public class ToolButton extends JButton  {	public kmfToolButton(Icon img)   {		super(img);		setMargin(new Insets(0,0,0,0));	}

devx-admin

Share the Post: