Package net.bnubot.bot.gui.components

Examples of net.bnubot.bot.gui.components.ConfigPanel


    Box boxTabsAndButtons = new Box(BoxLayout.Y_AXIS);
    add(boxTabsAndButtons);

    // CD Keys
    ConfigPanel boxAll = new ConfigPanel();
    {
      txtCDKeys = new ConfigTextArea(null);
      JScrollPane jsp = new JScrollPane(txtCDKeys);
      jsp.setPreferredSize(new Dimension(350, 350));
      boxAll.add(jsp);
      loadCDKeys();
    }

    if(keysOnly) {
      boxTabsAndButtons.add(boxAll);
    } else {
      tabs = new JTabbedPane();
      boxTabsAndButtons.add(tabs);

      tabs.addTab("CD Keys", boxAll);

      boxAll = new ConfigPanel();
      {
        txtBNLSServer = boxAll.makeText("BNLS Server", GlobalSettings.bnlsServer);
        txtEmail = boxAll.makeText("Email", GlobalSettings.email);

        ReleaseType[] releaseTypes;
        if(CurrentVersion.fromJar())
          releaseTypes = new ReleaseType[] {
            ReleaseType.Stable,
            ReleaseType.ReleaseCandidate,
            ReleaseType.Beta,
            ReleaseType.Alpha,
            ReleaseType.Nightly };
        else
          releaseTypes = new ReleaseType[] {
            ReleaseType.Development };
        cmbReleaseType = boxAll.makeCombo("Version Check", releaseTypes, false);
        cmbReleaseType.setSelectedItem(GlobalSettings.releaseType);

        String[] values = TimeZone.getAvailableIDs();
        Arrays.sort(values);
        cmbTimeZone = boxAll.makeCombo("TimeZone", values, false);
        cmbTimeZone.setSelectedItem(TimeFormatter.timeZone.getID());

        chkAutoConnect = boxAll.makeCheck("Auto Connect", GlobalSettings.autoConnect);
        chkAutoRejoin = boxAll.makeCheck("Auto Rejoin After Kicked", GlobalSettings.autoRejoin);
        chkEnableMirrorSelector = boxAll.makeCheck("Enable Mirror Selector", GlobalSettings.enableMirrorSelector);
        chkEnableFloodProtect = boxAll.makeCheck("Enable Flood Protect", GlobalSettings.enableFloodProtect);
        chkPacketLog = boxAll.makeCheck("Packet Log", GlobalSettings.packetLog);
      }
      tabs.addTab("Settings", boxAll);

      boxAll = new ConfigPanel();
      {
        chkProxyEnabled = boxAll.makeCheck("Enabled", GlobalSettings.socksEnabled);
        cmbProxyType = boxAll.makeCombo("Type", GlobalSettings.SOCKSType.values(), false);
        txtProxyHost = boxAll.makeText("Host", GlobalSettings.socksHost);
        spnProxyPort = boxAll.makeSpinner("Port", GlobalSettings.socksPort);
      }
      tabs.addTab("Proxy", boxAll);

      boxAll = new ConfigPanel();
      {
        boxAll.add(new JLabel("You must reopen profiles for these changes to take effect."));
        chkWhisperBack = boxAll.makeCheck("Whisper Command Responses", GlobalSettings.whisperBack);

        plugins = new ArrayList<Class<? extends EventHandler>>();
        chkEnabledPlugins = new ArrayList<JCheckBox>();
        for(Class<? extends EventHandler> plugin : PluginManager.getPlugins()) {
          // Do not allow the user to disable the GUI in this way
          if(plugin == GuiEventHandler.class)
            continue;

          JCheckBox chkEnablePlugin = boxAll.makeCheck(plugin.getSimpleName(), PluginManager.isEnabled(plugin));
          chkEnabledPlugins.add(chkEnablePlugin);
          plugins.add(plugin);
        }
        spnTriviaRoundLength = boxAll.makeSpinner("Trivia Round Length", Integer.valueOf(GlobalSettings.triviaRoundLength));
      }
      tabs.addTab("Plugins", boxAll);

      boxAll = new ConfigPanel();
      {
        String[] values = new String[] {
          "BNLogin@Gateway",
          "BNLogin",
          "ShortPrefix Account",
          "Prefix Account (BNLogin)",
          "Account",
          "Account (BNLogin)" };
        cmbBNUserToString = boxAll.makeCombo("BNetUser.toString()", values, false);
        cmbBNUserToString.setSelectedIndex(GlobalSettings.bnUserToString);
        cmbBNUserToStringUserList = boxAll.makeCombo("User List", values, false);
        cmbBNUserToStringUserList.setSelectedIndex(GlobalSettings.bnUserToStringUserList);
        cmbBNUserToStringCommandResponse = boxAll.makeCombo("Command Response", values, false);
        cmbBNUserToStringCommandResponse.setSelectedIndex(GlobalSettings.bnUserToStringCommandResponse);

        cmbTrayIconMode = boxAll.makeCombo("Tray Icon", TrayIconMode.values(), false);
        cmbTrayIconMode.setSelectedItem(GlobalSettings.trayIconMode);

        chkTrayMinimizeTo = boxAll.makeCheck("Minimize To System Tray (Java 6+)", GlobalSettings.trayMinimizeTo);
        chkTrayDisplayConnectDisconnect = boxAll.makeCheck("Tray: Connect/Disconnect", GlobalSettings.trayDisplayConnectDisconnect);
        chkTrayDisplayChannel = boxAll.makeCheck("Tray: Channel", GlobalSettings.trayDisplayChannel);
        chkTrayDisplayJoinPart = boxAll.makeCheck("Tray: Join/Part", GlobalSettings.trayDisplayJoinPart);
        chkTrayDisplayChatEmote = boxAll.makeCheck("Tray: Chat/Emote", GlobalSettings.trayDisplayChatEmote);
        chkTrayDisplayWhisper = boxAll.makeCheck("Tray: Whisper", GlobalSettings.trayDisplayWhisper);

        cmbTabCompleteMode = boxAll.makeCombo("Tab Complete Mode", TabCompleteMode.values(), false);
        cmbTabCompleteMode.setSelectedItem(GlobalSettings.tabCompleteMode);

        chkEnableTabCompleteUser = boxAll.makeCheck("User Tab Completion", GlobalSettings.enableTabCompleteUser);
        chkEnableTabCompleteCommand = boxAll.makeCheck("Command Tab Completion", GlobalSettings.enableTabCompleteCommand);
      }
      tabs.addTab("Display 1", boxAll);

      boxAll = new ConfigPanel();
      {
        chkEnableLegacyIcons = boxAll.makeCheck("Enable Legacy Icons", GlobalSettings.enableLegacyIcons);

        String[] values = new String[] { TimeFormatter.tsFormat, "%1$tH:%1$tM:%1$tS.%1$tL", "%1$tH:%1$tM:%1$tS", "%1$tH:%1$tM" };
        cmbTSFormat = boxAll.makeCombo("TimeStamp", values, true);
        cmbTSFormat.setSelectedItem(TimeFormatter.tsFormat);

        values = new String[] { "Starcraft", "Diablo 2", "Invigoration" };
        cmbColorScheme = boxAll.makeCombo("Color Scheme", values, false);
        cmbColorScheme.setSelectedIndex(GlobalSettings.colorScheme - 1);

        ArrayList<String> lafs = new ArrayList<String>();
        for(LookAndFeelInfo lafi : UIManager.getInstalledLookAndFeels())
          lafs.add(lafi.getName());
        cmbLookAndFeel = boxAll.makeCombo("Look and Feel", lafs.toArray(), false);
        cmbLookAndFeel.setSelectedItem(GlobalSettings.getLookAndFeel());
        cmbLookAndFeel.addItemListener(new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            for(LookAndFeelInfo lafi : UIManager.getInstalledLookAndFeels())
              if(lafi.getName().equals(cmbLookAndFeel.getSelectedItem()))
                GlobalSettings.setLookAndFeel(lafi);
          }
        });

        cmbPlasticTheme = boxAll.makeCombo("Plastic Theme", GlobalSettings.getLookAndFeelThemes(), false);
        cmbPlasticTheme.setSelectedItem(GlobalSettings.getLookAndFeelTheme());
        cmbPlasticTheme.addItemListener(new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            GlobalSettings.setLookAndFeelTheme(cmbPlasticTheme.getSelectedItem().toString());
          }
        });

        chkDisplayBattleNetMOTD = boxAll.makeCheck("Display Battle.net MOTD", GlobalSettings.displayBattleNetMOTD);
        chkDisplayBattleNetChannels = boxAll.makeCheck("Display Battle.net Channels", GlobalSettings.displayBattleNetChannels);
        chkDisplayJoinParts = boxAll.makeCheck("Display Join/Part Messages", GlobalSettings.getDisplayJoinParts());
        chkDisplayChannelUsers = boxAll.makeCheck("Display Channel Users On Join", GlobalSettings.displayChannelUsers);
        chkDisplaySlashCommands = boxAll.makeCheck("Display / Commands", GlobalSettings.displaySlashCommands);
        txtGuiFontFamily = boxAll.makeText("GUI Font Family", GlobalSettings.guiFontFamily);
        spnGuiFontSize = boxAll.makeSpinner("GUI Font Size", Integer.valueOf(GlobalSettings.guiFontSize));
      }
      tabs.addTab("Display 2", boxAll);

      boxAll = new ConfigPanel();
      {
        chkEnableDebug = boxAll.makeCheck("Enable debug logging", Out.isDebug());

        Properties props = Out.getProperties();
        chkDebug = new ArrayList<JCheckBox>(props.size());
        for (Enumeration<Object> en = props.keys(); en.hasMoreElements();) {
          String clazz = en.nextElement().toString();
          boolean chkEnabled = Boolean.parseBoolean(props.getProperty(clazz));
          JCheckBox chk = boxAll.makeCheck(clazz, chkEnabled);
          chkDebug.add(chk);
        }
      }
      tabs.addTab("Debug", boxAll);
    }
View Full Code Here


  private void initializeGui() {
    getContentPane().removeAll();

    final Box boxAll = new Box(BoxLayout.Y_AXIS);
    boolean hasCdKeys = true;
    ConfigPanel boxSettings = new ConfigPanel();
    {
      txtProfile = boxSettings.makeText("Profile", cs.profile);
      txtUsername = boxSettings.makeText("Username", cs.username);
      txtPassword = boxSettings.makePass("Password", cs.password);

      prodKeys = new ProductAndCDKeys(cs, boxSettings);
      prodKeys.addProductListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
          setVisibleFields();
        }});
      chkPlug = boxSettings.makeCheck("Enable Plug (No UDP support)", cs.enablePlug);
      chkBotNet = boxSettings.makeCheck("Enable BotNet", cs.enableBotNet);

      cmbConnectionType = boxSettings.makeCombo("Connection Type", ConnectionType.values(), false);
      cmbConnectionType.setSelectedItem(cs.connectionType);
      cmbConnectionType.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
          setVisibleFields();
        }});

      cmbServer = boxSettings.makeCombo("Server", (new String[] {}), false);
      cmbServer.setSelectedItem(cs.server);

      setVisibleFields();

      txtChannel = boxSettings.makeText("Channel", cs.channel);
      txtTrigger = boxSettings.makeText("Trigger", cs.trigger);

      {
        ConfigPanel boxLine = boxSettings.makePanel("Anti-Idle");
        chkAntiIdle = boxLine.makeCheck("Enabled", cs.enableAntiIdle);
        txtAntiIdle = boxLine.makeText("Message", cs.antiIdle);
      }

      txtAntiIdleTimer = boxSettings.makeText("Anti-Idle Timer", Integer.toString(cs.antiIdleTimer));
      chkGreetings = boxSettings.makeCheck("Enable Greetings", cs.enableGreetings);
View Full Code Here

  private void initializeGui() {
    boolean enableWrite = source.getMyUser().equals(p.getUser());

    setLayout(new FlowLayout(FlowLayout.LEFT));
    ConfigPanel boxAll = new ConfigPanel();
    {
      txtUsername = boxAll.makeText("Username", p.getUser());
      txtUsername.setEnabled(false);

      for(String key : p.keySet()) {
        ConfigTextField cta = boxAll.makeText(key, p.get(key));
        boolean enableThisKey = enableWrite && key.startsWith(UserProfile.PROFILE_);
        cta.setEnabled(enableThisKey);
        if(enableThisKey)
          txtBoxes.put(key, cta);
      }

      Box buttons = new Box(BoxLayout.X_AXIS);
      {
        if(enableWrite) {
          buttons.add(btnSave = new JButton("Save"));
          btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
              for(String key : txtBoxes.keySet())
                p.put(key, txtBoxes.get(key).getText());
              try {
                source.sendWriteUserData(p);
                dispose();
              } catch (Exception ex) {
                Out.popupException(ex, ProfileEditor.this);
              }
            }});
        }
        buttons.add(btnClose = new JButton("Close"));
        btnClose.addActionListener(new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dispose();
          }});
      }
      boxAll.add(buttons);
    }
    add(boxAll);
  }
View Full Code Here

    setModal(true);
    setVisible(true);
  }

  private void initializeGui() {
    ConfigPanel boxAll = new ConfigPanel();
    add(boxAll);

    cmbReleaseType = boxAll.makeCombo("Release Type", ReleaseType.values(), false);
    cmbReleaseType.setSelectedItem(vnCurrent.getReleaseType());
    spnMajor = boxAll.makeSpinner("Major", vnCurrent.getMajor());
    spnMinor = boxAll.makeSpinner("Minor", vnCurrent.getMinor());
    spnRevision = boxAll.makeSpinner("Revision", vnCurrent.getRevision());
    spnRelease = boxAll.makeSpinner("Release", vnCurrent.getRelease());

    btnSave = new JButton("Save");
    btnSave.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent arg0) {
        save();
      }});
    boxAll.add(btnSave);
  }
View Full Code Here

        jd.setVisible(true);
      }});
  }

  public void addWizardPage(AbstractWizardPage page) {
    ConfigPanel cp = new ConfigPanel();
    cp.addConfigValueChangeListener(this);

    page.createComponent(cp);
    cards.add(Integer.toString(pages.size()), cp);
    jd.pack();
View Full Code Here

TOP

Related Classes of net.bnubot.bot.gui.components.ConfigPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.