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);
}