All pastes #1520188 Raw Edit

BotUI

public text v1 · immutable
#1520188 ·published 2009-08-06 06:58 UTC
rendered paste body
/*
 * Created by JFormDesigner on Thu Mar 12 17:40:36 CET 2009
 */

package com.kbot2.UI;

import com.kbot2.accessors.GameCanvas;
import com.kbot2.bot.Bot;
import com.kbot2.bot.BotCallback;
import com.kbot2.handlers.ScriptHandler;
import com.kbot2.handlers.SettingsHandler;
import com.kbot2.handlers.settings.BotConstants;
import com.kbot2.handlers.settings.ScriptLoader;
import com.kbot2.handlers.settings.ScriptSetting;
import com.kbot2.handlers.settings.Setting;
import com.kbot2.loader.Loader;
import com.kbot2.out.Console;
import com.kbot2.scriptable.Script;
import com.kbot2.scriptable.LoadedScript;
import org.jdesktop.layout.GroupLayout;
import org.jdesktop.layout.LayoutStyle;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.plaf.metal.MetalIconFactory;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
/**
 * @author Jan Ove
 */
public class BotUI extends JFrame implements Thread.UncaughtExceptionHandler {
    public static final List<Bot> botList = new LinkedList<Bot>();
    private static final JMenuItem[] recentScripts = new JMenuItem[5];
    private BotSpectateUI botSpectate;

    public BotUI() {
        JPopupMenu.setDefaultLightWeightPopupEnabled(false);
        initComponents();
        createTray();

        // remove the switch tab listener from the tabbedpane
        setFocusable(false);
        InputMap im = tabbedPane.getInputMap(JComponent.WHEN_FOCUSED);
        im.clear();

        /*while (im != null) {
            KeyStroke stroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
            im.remove(stroke1);
            stroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0);
            im.remove(stroke1);
            stroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
            im.remove(stroke1);
            stroke1 = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
            im.remove(stroke1);
            im = im.getParent();
        }*/
        this.setVisible(true);
        Console.setTextArea(consoleTextArea);
        Console.writeLine(this, "KBot2 by Kosaki started.");
        ScriptLoader.loadScripts();
        Thread.setDefaultUncaughtExceptionHandler(this);
        editorPane1.setText("Loading MOTD...");
        try {
            editorPane1.setPage("http://kbot.info/bot/MOTD.php");
            editorPane1.updateUI();
        } catch (IOException e) {
            editorPane1.setText("Could not load MOTD.");
        }
        updateRecentRanScripts();
        fillDebugMenu();
        BotConstants.loadWorlds();
    }

    private void createTray() {
        try{
            //if (!System.getProperty("os.name").toLowerCase().contains("mac")) {

                TrayIcon trayIcon = new TrayIcon(getTrayImage(), "KBot", createAWTPopupMenu());
                trayIcon.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        openTrayActionPerformed();
                    }
                });
                SystemTray.getSystemTray().add(trayIcon);
            //}
        }catch(Exception e){
            Console.writeLine(this, "Could not create the tray icon.");
            toTrayMenuItem.setEnabled(false);
        }
    }

    private PopupMenu createAWTPopupMenu(){
        PopupMenu menu = new PopupMenu();

        MenuItem open = new MenuItem("Open");
        open.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                openTrayActionPerformed();
            }
        });

        menu.add(open);

        MenuItem hide = new MenuItem("Hide");
        hide.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                hideTrayActionPerformed();
            }
        });

        menu.add(hide);
        
        MenuItem exit = new MenuItem("Exit");

        exit.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                System.exit(0);

            }

        });

        menu.add(exit);

        return menu;
    }

    public void openTrayActionPerformed(){
        this.setVisible(true);
    }

    public void hideTrayActionPerformed(){
        this.setVisible(false);
    }

    private Image getTrayImage() {
        Icon defaultIcon = MetalIconFactory.getTreeComputerIcon();

        Image img = new BufferedImage(defaultIcon.getIconWidth(),

                defaultIcon.getIconHeight(),

                BufferedImage.TYPE_INT_ARGB);

        defaultIcon.paintIcon(new Panel(), img.getGraphics(), 0, 0);
        return img;
    }

    public void fillDebugMenu() {
        for (Setting setting : SettingsHandler.getSetting("loadedScripts", new String[]{"script"})) {
            final ScriptSetting script = new ScriptSetting(setting);
            for (String tag : script.getTags()) {
                if (tag == null)
                    continue;
                if (tag.equalsIgnoreCase("debug")) {
                    final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(script.getName());
                    menuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            Bot selectedBot = getSelectedBot();
                            if (selectedBot != null) {
                                try {
                                    selectedBot.getClient().getMyPlayer().getPosX();
                                } catch (Exception ex) {
                                    return;
                                }
                                Script scriptObj = selectedBot.getScriptHandler().loadScript(script.getFileName());
                                selectedBot.getScriptHandler().runScript(scriptObj);
                            } else {
                                JOptionPane.showMessageDialog(null, "Please select a bot first.", "Error", JOptionPane.ERROR_MESSAGE);
                                menuItem.setSelected(false);
                            }
                        }
                    });
                    debugMenu.add(menuItem);
                    break;
                }
            }
        }
    }

    public static void updateRecentRanScripts() {
        scriptMenu.removeAll();
        scriptMenu.add(startScriptMenuItem);
        scriptMenu.add(stopScriptMenuItem);
        scriptMenu.addSeparator();
        scriptMenu.add(accontSelectorMenuItem);
        scriptMenu.addSeparator();

        Setting setting = SettingsHandler.getSetting("recentScripts", null)[0];
        if (!setting.children.isEmpty()) {
            int counter = 0;
            for (Setting child : setting.children) {
                String scriptName = "";
                String fileName = "";
                for (Setting child2 : child.children) {
                    if (child2.name.equals("name")) {
                        scriptName = child2.value;
                    } else if (child2.name.equals("fileName")) {
                        fileName = child2.value;
                    }
                }

                final String fileName1 = fileName;
                recentScripts[counter] = new JMenuItem(scriptName);
                recentScripts[counter].addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        Bot selectedBot = getSelectedBot();
                        if (selectedBot != null) {
                            Script script = selectedBot.getScriptHandler().loadScript(fileName1);
                            selectedBot.getScriptHandler().runScript(script);
                        } else {
                            JOptionPane.showMessageDialog(null, "Please select a bot first.", "Error", JOptionPane.ERROR_MESSAGE);
                        }
                    }
                });
                scriptMenu.add(recentScripts[counter]);
            }
            counter++;
        }
        scriptMenu.updateUI();
    }

    public void uncaughtException(Thread t, Throwable e) {
        Console.writeLine(this, "[" + e + "][" + t.getName() + "]");
        for (StackTraceElement element : e.getStackTrace()) {
            Console.writeLine(this, element.toString());
        }
        e.printStackTrace(System.out);
    }

    public void newBot() {
        Bot bot = new Bot("No account chosen");
        bot.setPreferredSize(new Dimension(756, 504));
        botList.add(bot);
        Loader loader = bot.getLoader();
        tabbedPane.addTab("Bot[No account chosen]", bot);
        tabbedPane.setSelectedComponent(bot);
        tabbedPane.updateUI();
        Set set = new HashSet(tabbedPane.getFocusTraversalKeys(0));
        set.clear();
        tabbedPane.setFocusTraversalKeys(0, set);

        if (JOptionPane.showConfirmDialog(this, "Do you want to select an account for this bot?", "Account selection", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            new SelectAccount(bot);
        }
    }

    public static BotCallback getBotCallback(GameCanvas gameCanvas) {
        BotCallback out;
        for (Bot bot : botList) {
            out = bot.getBotCallback(gameCanvas);
            if (out != null)
                return out;
        }
        return null;
    }

    private void newBotMenuItemActionPerformed() {
        newBot();
    }

    public static Bot getSelectedBot() {
        Component selectedComp = tabbedPane.getSelectedComponent();
        if (selectedComp instanceof Bot)
            return (Bot) selectedComp;
        return null;
    }

    public static void setInputEnabled(Bot bot, boolean inputEnabled) {
        if (bot == getSelectedBot()) {
            if (bot.getInputEnabled() != inputEnabled) {
                userInputToggle.doClick(); // fake a click so the model also changes.
            }
        } else {
            bot.setInputEnabled(inputEnabled);
        }
    }

    private void userInputToggleActionPerformed() {
        boolean enabled = userInputToggle.isSelected();
        Bot selectedBot = getSelectedBot();
        selectedBot.setInputEnabled(enabled);
        if(!selectedBot.hasFocus())
                selectedBot.requestFocus();
        if (enabled) {
            userInputToggle.setText("User input[ON]");

        } else {
            userInputToggle.setText("User input[OFF]");
        }
    }

    private void tabbedPaneStateChanged() {
        final Bot selectedBot = getSelectedBot();
        if (selectedBot != null) {
            screenshotButton.setEnabled(true);
            userInputToggle.setEnabled(true);
            botSpecificSettingsButton.setEnabled(true);
            pauseToggleButton.setEnabled(true);
            setInputEnabled(selectedBot, selectedBot.isInputEnabled());
            final boolean paused = selectedBot.getScriptHandler().pausedAll;
            pauseToggleButton.setSelected(paused);
            if(paused){
                pauseToggleButton.setText("Resume");
            }
            else{
                pauseToggleButton.setText("Pause");
            }

            if(!selectedBot.hasFocus())
                selectedBot.requestFocus();
        } else {
            screenshotButton.setEnabled(false);
            pauseToggleButton.setEnabled(false);
            userInputToggle.setEnabled(false);
            botSpecificSettingsButton.setEnabled(false);

        }
    }


    private void startScriptMenuItemActionPerformed() {
        Bot selected = getSelectedBot();
        if (selected == null) {
            JOptionPane.showMessageDialog(this, "Please select a bot first.", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        new ScriptSelector(selected.getScriptHandler());
    }

    private void stopScriptMenuItemActionPerformed() {
        Bot selected = getSelectedBot();
        if (selected == null) {
            JOptionPane.showMessageDialog(this, "Please select a bot first.", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }

        ScriptHandler scriptHandler = selected.getScriptHandler();
        if (scriptHandler.runningScripts.size() == 1) {
            scriptHandler.stopAllScripts();
        } else if (!scriptHandler.runningScripts.isEmpty()) {
            new StopScript(scriptHandler);
        } else {
            JOptionPane.showMessageDialog(this, "There is no running scripts.", "Error", JOptionPane.ERROR_MESSAGE);
        }

    }

    private void closeBotMenuItemActionPerformed() {
        Bot selected = getSelectedBot();
        if (selected == null) {
            JOptionPane.showMessageDialog(this, "Please select a bot first.", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (JOptionPane.showConfirmDialog(this, "Are you sure you want to close this bot?", "Confirm", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            selected.close();
            tabbedPane.remove(selected);
            System.gc();
        }
    }

    private void botConfigMenuItemActionPerformed() {
        new BotConfigUI();
    }

    private void accountManagerMenuItemActionPerformed() {
        new AccountManagerUI();
    }

    private void accontSelectorMenuItemActionPerformed() {
        Bot bot = getSelectedBot();
        if (bot != null) {
            new SelectAccount(bot);
        }
    }

    public static void renameBot(Bot bot, String newName) {
        if (bot == null)
            return;
        int index = tabbedPane.indexOfComponent(bot);
        Console.writeLine(null, "HaXD Title. ToshiXZ R Pr0");
        if (index != -1) {
            tabbedPane.setTitleAt(index, "Bot[" + newName + "]");
        }
        tabbedPane.updateUI();

    }

    private void botSpecificSettingsButtonActionPerformed() {
        Bot bot = getSelectedBot();
        if (bot == null) {
            JOptionPane.showMessageDialog(this, "Please select a bot first", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        new BotSpecificSettingUI(bot).setVisible(true);
    }

    private void reloadScriptsButtonActionPerformed() {
        ScriptLoader.loadScripts();
    }

    private void botSpecStartMenuItemActionPerformed() {
        if(botSpectate == null){
            botSpectate = new BotSpectateUI();
        }
        botSpectate.start();
        if(tabbedPane.indexOfComponent(botSpectate) == -1){
            tabbedPane.insertTab("Spectate", null, botSpectate, "Bot Spectator", 1);
            //tabbedPane.addTab("Spectate", botSpectate);
        }
        tabbedPane.setSelectedComponent(botSpectate);        
        tabbedPane.updateUI();
    }

    private void stopSpectateMenuItemActionPerformed() {
        if(botSpectate == null)
            return;
        botSpectate.stop();
        tabbedPane.remove(botSpectate);
    }

    private void randomConfigMenuItemActionPerformed() {
        Bot selected = getSelectedBot();
        if (selected == null) {
            JOptionPane.showMessageDialog(this, "Please select a bot first.", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        new RandomSelector(selected.botEnv).setVisible(true);
    }

    private void pauseToggleButtonActionPerformed() {
        boolean enabled = pauseToggleButton.isSelected();
        Bot selectedBot = getSelectedBot();
        if(!selectedBot.hasFocus())
                selectedBot.requestFocus();
        if (enabled) {
            pauseToggleButton.setText("Resume");
            selectedBot.getScriptHandler().pauseAllScripts();
        } else {
            pauseToggleButton.setText("Pause");
            selectedBot.getScriptHandler().resumeAllScripts();
        }
    }

    private void screenshotButtonActionPerformed() {
        Bot bot = getSelectedBot();
        if(bot == null){
            return;
        }
        new ScreenshotForm(bot).setVisible(true);
    }

    private void stopAllItemsMenuItemActionPerformed() {
        Bot bot = getSelectedBot();
        if(bot == null){
            JOptionPane.showMessageDialog(this, "Please select a bot first.", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        List<Script> stopScripts = new ArrayList<Script>();
        for(LoadedScript loadedScript: bot.getScriptHandler().runningScripts){
            final String[] tags = loadedScript.script.getTags();
            if(tags != null){
                for(String tag: tags){
                    if(tag == null)
                        continue;
                    if(tag.toLowerCase().equals("debug")){
                        stopScripts.add(loadedScript.script);
                        break;
                    }
                }
            }
        }
        if(!stopScripts.isEmpty()){
            for(Script script: stopScripts){
                bot.getScriptHandler().stopScript(script);
            }
        }
    }


    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        menuBar = new JMenuBar();
        botMenu = new JMenu();
        newBotMenuItem = new JMenuItem();
        closeBotMenuItem = new JMenuItem();
        toTrayMenuItem = new JMenuItem();
        reloadScriptsButton = new JMenuItem();
        scriptMenu = new JMenu();
        startScriptMenuItem = new JMenuItem();
        stopScriptMenuItem = new JMenuItem();
        accontSelectorMenuItem = new JMenuItem();
        debugMenu = new JMenu();
        stopAllDebugsMenuItem = new JMenuItem();
        settingsMenu = new JMenu();
        randomConfigMenuItem = new JMenuItem();
        botConfigMenuItem = new JMenuItem();
        accountManagerMenuItem = new JMenuItem();
        toolsMenu = new JMenu();
        botSpectatorMenu = new JMenu();
        botSpecStartMenuItem = new JMenuItem();
        stopSpectateMenuItem = new JMenuItem();
        separator1 = new JPopupMenu.Separator();
        screenshotButton = new JButton();
        botSpecificSettingsButton = new JButton();
        pauseToggleButton = new JToggleButton();
        userInputToggle = new JToggleButton();
        tabbedPane = new JTabbedPane();
        scrollPane2 = new JScrollPane();
        editorPane1 = new JEditorPane();
        tabbedPane1 = new JTabbedPane();
        scrollPane1 = new JScrollPane();
        consoleTextArea = new JTextArea();

        //======== this ========
        setTitle("KBot2");
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        Container contentPane = getContentPane();

        //======== menuBar ========
        {

            //======== botMenu ========
            {
                botMenu.setText("Bot");

                //---- newBotMenuItem ----
                newBotMenuItem.setText("New bot");
                newBotMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        newBotMenuItemActionPerformed();
                    }
                });
                botMenu.add(newBotMenuItem);

                //---- closeBotMenuItem ----
                closeBotMenuItem.setText("Close bot");
                closeBotMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        closeBotMenuItemActionPerformed();
                    }
                });
                botMenu.add(closeBotMenuItem);
                botMenu.addSeparator();

                //---- toTrayMenuItem ----
                toTrayMenuItem.setText("To tray");
                toTrayMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        hideTrayActionPerformed();
                    }
                });
                botMenu.add(toTrayMenuItem);
                botMenu.addSeparator();

                //---- reloadScriptsButton ----
                reloadScriptsButton.setText("Reload scripts");
                reloadScriptsButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        reloadScriptsButtonActionPerformed();
                    }
                });
                botMenu.add(reloadScriptsButton);
            }
            menuBar.add(botMenu);

            //======== scriptMenu ========
            {
                scriptMenu.setText("Script");

                //---- startScriptMenuItem ----
                startScriptMenuItem.setText("Start script");
                startScriptMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        startScriptMenuItemActionPerformed();
                    }
                });
                scriptMenu.add(startScriptMenuItem);

                //---- stopScriptMenuItem ----
                stopScriptMenuItem.setText("Stop script");
                stopScriptMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        stopScriptMenuItemActionPerformed();
                    }
                });
                scriptMenu.add(stopScriptMenuItem);
                scriptMenu.addSeparator();

                //---- accontSelectorMenuItem ----
                accontSelectorMenuItem.setText("Account Selector");
                accontSelectorMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        accontSelectorMenuItemActionPerformed();
                    }
                });
                scriptMenu.add(accontSelectorMenuItem);
                scriptMenu.addSeparator();
            }
            menuBar.add(scriptMenu);

            //======== debugMenu ========
            {
                debugMenu.setText("Debug");

                //---- stopAllDebugsMenuItem ----
                stopAllDebugsMenuItem.setText("Stop all debugs");
                stopAllDebugsMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        stopAllItemsMenuItemActionPerformed();
                    }
                });
                debugMenu.add(stopAllDebugsMenuItem);
                debugMenu.addSeparator();
            }
            menuBar.add(debugMenu);

            //======== settingsMenu ========
            {
                settingsMenu.setText("Settings");

                //---- randomConfigMenuItem ----
                randomConfigMenuItem.setText("Anti-Random configuration");
                randomConfigMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        randomConfigMenuItemActionPerformed();
                    }
                });
                settingsMenu.add(randomConfigMenuItem);

                //---- botConfigMenuItem ----
                botConfigMenuItem.setText("Bot configuration");
                botConfigMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        botConfigMenuItemActionPerformed();
                    }
                });
                settingsMenu.add(botConfigMenuItem);

                //---- accountManagerMenuItem ----
                accountManagerMenuItem.setText("Account manager");
                accountManagerMenuItem.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        accountManagerMenuItemActionPerformed();
                    }
                });
                settingsMenu.add(accountManagerMenuItem);
            }
            menuBar.add(settingsMenu);

            //======== toolsMenu ========
            {
                toolsMenu.setText("Tools");

                //======== botSpectatorMenu ========
                {
                    botSpectatorMenu.setText("Bot Spectator");

                    //---- botSpecStartMenuItem ----
                    botSpecStartMenuItem.setText("Start");
                    botSpecStartMenuItem.setSelectedIcon(null);
                    botSpecStartMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            botSpecStartMenuItemActionPerformed();
                        }
                    });
                    botSpectatorMenu.add(botSpecStartMenuItem);

                    //---- stopSpectateMenuItem ----
                    stopSpectateMenuItem.setText("Stop");
                    stopSpectateMenuItem.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            stopSpectateMenuItemActionPerformed();
                        }
                    });
                    botSpectatorMenu.add(stopSpectateMenuItem);
                }
                toolsMenu.add(botSpectatorMenu);
            }
            menuBar.add(toolsMenu);
            menuBar.add(separator1);

            //---- screenshotButton ----
            screenshotButton.setText("Screenshot");
            screenshotButton.setEnabled(false);
            screenshotButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    screenshotButtonActionPerformed();
                }
            });
            menuBar.add(screenshotButton);

            //---- botSpecificSettingsButton ----
            botSpecificSettingsButton.setText("Settings");
            botSpecificSettingsButton.setEnabled(false);
            botSpecificSettingsButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    botSpecificSettingsButtonActionPerformed();
                }
            });
            menuBar.add(botSpecificSettingsButton);

            //---- pauseToggleButton ----
            pauseToggleButton.setText("Pause");
            pauseToggleButton.setEnabled(false);
            pauseToggleButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    pauseToggleButtonActionPerformed();
                }
            });
            menuBar.add(pauseToggleButton);

            //---- userInputToggle ----
            userInputToggle.setText("User input[ON]");
            userInputToggle.setSelected(true);
            userInputToggle.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    userInputToggleActionPerformed();
                }
            });
            menuBar.add(userInputToggle);
        }
        setJMenuBar(menuBar);

        //======== tabbedPane ========
        {
            tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
            tabbedPane.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    tabbedPaneStateChanged();
                }
            });

            //======== scrollPane2 ========
            {

                //---- editorPane1 ----
                editorPane1.setEditable(false);
                scrollPane2.setViewportView(editorPane1);
            }
            tabbedPane.addTab("MOTD", scrollPane2);

        }

        //======== tabbedPane1 ========
        {
            tabbedPane1.setTabPlacement(SwingConstants.LEFT);

            //======== scrollPane1 ========
            {

                //---- consoleTextArea ----
                consoleTextArea.setTabSize(4);
                consoleTextArea.setEditable(false);
                consoleTextArea.setBackground(Color.white);
                scrollPane1.setViewportView(consoleTextArea);
            }
            tabbedPane1.addTab("Console", scrollPane1);

        }

        GroupLayout contentPaneLayout = new GroupLayout(contentPane);
        contentPane.setLayout(contentPaneLayout);
        contentPaneLayout.setHorizontalGroup(
            contentPaneLayout.createParallelGroup()
                .add(tabbedPane, GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE)
                .add(GroupLayout.TRAILING, tabbedPane1, GroupLayout.DEFAULT_SIZE, 774, Short.MAX_VALUE)
        );
        contentPaneLayout.setVerticalGroup(
            contentPaneLayout.createParallelGroup()
                .add(contentPaneLayout.createSequentialGroup()
                    .add(tabbedPane, GroupLayout.PREFERRED_SIZE, 537, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.RELATED)
                    .add(tabbedPane1, GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE))
        );

        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    private JMenuBar menuBar;
    private JMenu botMenu;
    private JMenuItem newBotMenuItem;
    private JMenuItem closeBotMenuItem;
    private JMenuItem toTrayMenuItem;
    private JMenuItem reloadScriptsButton;
    private static JMenu scriptMenu;
    private static JMenuItem startScriptMenuItem;
    private static JMenuItem stopScriptMenuItem;
    private static JMenuItem accontSelectorMenuItem;
    private JMenu debugMenu;
    private JMenuItem stopAllDebugsMenuItem;
    private JMenu settingsMenu;
    private JMenuItem randomConfigMenuItem;
    private JMenuItem botConfigMenuItem;
    private JMenuItem accountManagerMenuItem;
    private JMenu toolsMenu;
    private JMenu botSpectatorMenu;
    private JMenuItem botSpecStartMenuItem;
    private JMenuItem stopSpectateMenuItem;
    private JPopupMenu.Separator separator1;
    private JButton screenshotButton;
    private JButton botSpecificSettingsButton;
    private JToggleButton pauseToggleButton;
    public static JToggleButton userInputToggle;
    private static JTabbedPane tabbedPane;
    private JScrollPane scrollPane2;
    private JEditorPane editorPane1;
    private JTabbedPane tabbedPane1;
    private JScrollPane scrollPane1;
    private JTextArea consoleTextArea;
    // JFormDesigner - End of variables declaration  //GEN-END:variables
}