private void init(final boolean log) {
		miscLogin.setEnabled(false);
		miscFps.setEnabled(false);
		miscFloor.setEnabled(false);
		
		setPreferredSize(new Dimension(Configuration.BOT_TOOLBAR_WIDTH, Configuration.BOT_TOOLBAR_HEIGHT));
		setFloatable(false);
		
		settings.add(accounts);
		settings.addSeparator();
        settings.add(pasteScript);
		interfaces.add(interfacesInventory);
		interfaces.add(interfacesMenu);
		interfaces.add(interfacesWidgets);
                interfaces.add(interfaceExplorer);
		settings.add(interfaces);
		players.add(playersMy);
		players.add(playersInfo);
		players.add(playersModels);
		players.add(playersHulls);
		settings.add(players);
		npcs.add(npcsInfo);
		npcs.add(npcsModels);
		npcs.add(npcsHulls);
		settings.add(npcs);
		objects.add(objectsInfo);
		objects.add(objectsModels);
		objects.add(objectsHulls);
		settings.add(objects);
		misc.add(miscMouse);
		misc.add(miscCursor);
		misc.add(miscTiles);
		misc.add(miscCamera);
		misc.add(miscLogin);
		misc.add(miscFps);
		misc.add(miscFloor);
		misc.add(miscGroundInfos);
		misc.add(miscGroundModels);
		misc.add(miscGroundHulls);
		misc.add(miscWidgetSettings);
		misc.add(miscVarbitSettings);
		settings.add(misc);
		settings.addSeparator();
		settings.add(exit);
		
		newBotButton.setIcon(Configuration.icon("res/icon_plus_small.png"));
		newBotButton.setContentAreaFilled(false);
		newBotButton.setRolloverEnabled(true);
		newBotButton.setRolloverIcon(Configuration.icon("res/icon_plus_small_highlighted.png"));
	    runScriptButton.setIcon(Configuration.icon("res/icon_start_small.png"));
	    runScriptButton.setContentAreaFilled(false);
	    runScriptButton.setRolloverEnabled(true);
	    runScriptButton.setRolloverIcon(Configuration.icon("res/icon_start_small_highlighted.png"));
	    pauseScriptButton.setIcon(Configuration.icon("res/icon_pause_small.png"));
	    pauseScriptButton.setContentAreaFilled(false);
	    pauseScriptButton.setRolloverEnabled(true);
	    pauseScriptButton.setRolloverIcon(Configuration.icon("res/icon_pause_small_highlighted.png"));
	    stopScriptButton.setIcon(Configuration.icon("res/icon_stop_small.png"));
	    stopScriptButton.setContentAreaFilled(false);
	    stopScriptButton.setRolloverEnabled(true);
	    stopScriptButton.setRolloverIcon(Configuration.icon("res/icon_stop_small_highlighted.png"));
	    inputButton.setIcon(inputEnabled);
	    inputButton.setContentAreaFilled(false);
	    inputButton.setRolloverEnabled(true);
	    inputButton.setRolloverIcon(inputEnabledHighlighted);
	    settingsButton.setIcon(Configuration.icon("res/icon_settings_small.png"));
	    settingsButton.setContentAreaFilled(false);
	    settingsButton.setRolloverEnabled(true);
	    settingsButton.setRolloverIcon(Configuration.icon("res/icon_settings_small_highlighted.png"));
	    
	    accounts.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				new BotAccountManager().setVisible(true);
			}
	    });
	    newBotButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				window.addNewBot(log);
			}
		});
	    runScriptButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				//if (window.getActiveBot() == null) return;
				final BotScriptViewer bsv = new BotScriptViewer();
				bsv.load();
				
				//new BotScriptSelector(log).setVisible(true);
//				Bot bot = window.getActiveBot();
//				if (bot != null) {
//					String scriptname = JOptionPane.showInputDialog("Enter script class name: ");
//					try {
//						if (scriptname == null || scriptname.equals("null") || scriptname.length() == 0) {
//							return;
//						}
//						if (!scriptname.contains(Configuration.SCRIPT_PACKAGE)) {
//							scriptname = Configuration.SCRIPT_PACKAGE + scriptname;
//						}
//						Class<?> scriptclass = this.getClass().getClassLoader().loadClass(scriptname);
//						bot.pushScript((Script) scriptclass.newInstance(), false, null);
//					} catch (Exception exc) {
//						bot.getLogger().log(new LogRecord(Level.SEVERE, "Error loading script class: " + scriptname));
//						exc.printStackTrace();
//					}
//				}
			}
		});
		stopScriptButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Bot bot = window.getActiveBot();
				if (bot != null) bot.popScript();
			}
		});

        pauseScriptButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                final Bot bot = window.getActiveBot();
                if (bot != null) {
                    synchronized (bot.scriptStack) {
                        if (!bot.isScriptStackEmpty()) {
                            final Script script = bot.peekScript();
                            System.out.println((script.isPaused() ? "Resumed" : "Paused") + " script: " + script.getManifest().name());
                            script.setPaused(!script.isPaused());
                            //window.getActiveBot().log(window.getClass(), (script.isPaused() ? "Resumed" : "Paused") + " script: " + script.getManifest().name());
                        }
                    }
                }
            }
        });
		
        settingsButton.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                settings.show(e.getComponent(), e.getX(), e.getY());
            }
        });
        
        inputButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Bot bot = window.getActiveBot();
				if (bot != null && bot.getInputHandler() != null) {
					bot.getInputHandler().setHumanInput(!bot.getInputHandler().isHumanInput());
					if (bot.getInputHandler().isHumanInput()) {
						inputButton.setIcon(inputEnabled);
						inputButton.setRolloverIcon(inputEnabledHighlighted);
					} else {
						inputButton.setIcon(inputDisabled);
						inputButton.setRolloverIcon(inputDisabledHighlighted);
					}
				}
			}
        });

        pasteScript.addActionListener(new ActionListener() {
      			public void actionPerformed(ActionEvent e) {
                      String url = JOptionPane.showInputDialog("Enter Pastebin URL :");
                      new PasteScript(url);
                  }
              });
        
        //misc menu
        miscMouse.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscMouse, DebugMouseInfo.class);
			}
        });
        miscCamera.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscCamera, DebugCameraInfo.class);
			}
        });
        miscCursor.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscCursor, DebugCursor.class);
			}
        });
        miscTiles.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscTiles, DebugTiles.class);
			}
        });
        miscGroundInfos.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscGroundInfos, DebugGroundInfos.class);
			}
        });
        miscGroundModels.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscGroundModels, DebugGroundModels.class);
			}
        });
        miscGroundHulls.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscGroundHulls, DebugGroundHulls.class);
			}
        });
        miscWidgetSettings.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscWidgetSettings, DebugWidgetSettings.class);
			}
        });
        miscVarbitSettings.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(miscVarbitSettings, DebugVarbitSettings.class);
			}
        });
        //players menu
        playersMy.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
				toggleDebugger(playersMy, DebugPlayerInfo.class);
			}
        });
        playersInfo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(playersInfo, DebugPlayersInfo.class);
			}
        });
        playersModels.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(playersModels, DebugPlayerModels.class);
			}
        });
        playersHulls.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(playersHulls, DebugPlayerHulls.class);
			}
        });
        //npc menu
        npcsInfo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(npcsInfo, DebugNpcInfo.class);
			}
        });
        npcsModels.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(npcsModels, DebugNpcModels.class);
			}
        });
        npcsHulls.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(npcsHulls, DebugNpcHulls.class);
			}
        });
        //object menu
        objectsInfo.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(objectsInfo, DebugObjectInfo.class);
			}
        });
        objectsModels.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(objectsModels, DebugObjectModels.class);
			}
        });
        objectsHulls.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(objectsHulls, DebugObjectHulls.class);
			}
        });
        
        //interfaces menu
        interfacesInventory.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(interfacesInventory, DebugInventory.class);
			}
        });
        interfacesMenu.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(interfacesMenu, DebugMenu.class);
			}
        });
        interfacesWidgets.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				toggleDebugger(interfacesWidgets, DebugWidgets.class);
			}
        });
        interfaceExplorer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
                    Bot b = window.getActiveBot();
                    IClient client = (IClient) b.getApplet();
                    ScriptContext c = new ScriptContext(b, client, null);
                    if (b != null && c.game.getGameState() == GameState.INGAME) {
                        final BotInterfaceExplorer bie = new BotInterfaceExplorer(c);
                        final HijackCanvas canvas = b.getCanvas();
                        canvas.getListeners().add(bie);
                        java.awt.EventQueue.invokeLater(new Runnable() {

                            public void run() {
                                bie.addWindowListener(new WindowAdapter() {

                                    @Override
                                    public void windowClosing(WindowEvent e) {
                                        bie.dispose();
                                        canvas.getListeners().remove(bie);
                                    }
                                });
                                bie.setVisible(true);
                            }
                        });
                    }
                }
            });
        exit.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
        });
        
        updateComponents(null);
	}