private void addButton(JPanel container, Action action, Hashtable actions, Icon icon) { String actionName = (String) action.getValue(Action.NAME); String actionCommand = (String) action.getValue(Action.ACTION_COMMAND_KEY); JButton button = new JButton(icon); button.setActionCommand(actionCommand); button.addActionListener(DeepaMehtaClientUtils.getActionByName(actionName, actions)); container.add(button); toolbarButtons[buttonIndex++] = button; }