if(i == null || i.getIconHeight() > BUTTON_SIZE || i.getIconWidth() > BUTTON_SIZE)
i = new ImageIcon(Program.getImage("noicon.gif"));
String name = t.getName();
ToolBarToggleButton button = new ToolBarToggleButton(i);
button.setToolTipText(name);
button.setMinimumSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
button.setSize(BUTTON_SIZE, BUTTON_SIZE);
button.setMaximumSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
button.setFocusable(false);
button.setRolloverEnabled(true);
bg.add(button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fireToolChangedEvent(t);
}
});