@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents() {

		panelNews = new javax.swing.JPanel();
		jScrollPane2 = new javax.swing.JScrollPane();
		EditorPaneNews = new javax.swing.JEditorPane();
		EditorPaneNews.setForeground(Color.WHITE);
		EditorPaneNews.setBackground(Color.DARK_GRAY);
		panelControls = new TexturedPanel();
		panelControls.setBorder(null);
		LabelUsername = new javax.swing.JLabel();
		labelPassword = new javax.swing.JLabel();
		textFieldUsername = new javax.swing.JTextField();
		textFieldUsername.setBackground(Color.WHITE);
		textFieldUsername.setForeground(Color.DARK_GRAY);
		PasswordField = new javax.swing.JPasswordField();
		CheckBoxSave = new javax.swing.JCheckBox();
		ButtonLogin = new javax.swing.JButton();
		LabelStatus = new javax.swing.JLabel();
		
		comboBoxMemSettings = new JComboBox();

		ComboBoxSelectClient = new javax.swing.JComboBox();
		ComboBoxSelectClient.setToolTipText("Выберете сервер из списка ниже");
		// LabelRegistration = new javax.swing.JLabel();
		LabelStatusText = new javax.swing.JLabel();
		// ButtonBugLink = new javax.swing.JButton();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle(GlobalVar.MainWndTitle);
		setName("MainWindow");

		panelNews.setBackground(new java.awt.Color(204, 204, 204));

		EditorPaneNews.setEditable(false);
		EditorPaneNews.setBorder(null);
		EditorPaneNews.setDefaultLocale(new Locale("UTF-8"));
		EditorPaneNews.setContentType("text/html"); // NOI18N
		EditorPaneNews
				.setText("<html><body><font color=\\\"#808080\\\"><br><br><br><br><br><br><br><center>Loading update news..</center></font></body></html>");
		jScrollPane2.setViewportView(EditorPaneNews);
		EditorPaneNews.addHyperlinkListener(new HyperlinkListener() {
			public void hyperlinkUpdate(HyperlinkEvent he) {
				if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
					try {
						Utils.openLink(he.getURL().toURI());
					} catch (Exception e) {
						e.printStackTrace();
					}
			}
		});
		new Thread() {
			public void run() {
				try {
					EditorPaneNews.setPage(new URL(GlobalVar.NewsURL));
				} catch (Exception e) {
					// e.printStackTrace();
					EditorPaneNews
							.setText("<html><body><font color=\"#808080\"><br><br><br><br><br><br><br><center>Failed to update news<br></center></font></body></html>");
				}
			}
		}.start();

		panelControls.setBackground(new java.awt.Color(204, 204, 204));
		panelControls.setToolTipText("");
		panelControls.setMaximumSize(new java.awt.Dimension(231, 32767));
		panelControls.setName(""); // NOI18N

		LabelUsername.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		LabelUsername.setForeground(new java.awt.Color(255, 255, 255));
		LabelUsername.setText("Логин:");
		LabelUsername.setFocusable(false);

		labelPassword.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		labelPassword.setForeground(new java.awt.Color(255, 255, 255));
		labelPassword.setText("Пароль:");
		labelPassword.setFocusable(false);

		textFieldUsername.setText(GlobalVar.userName);
		textFieldUsername.addFocusListener(new java.awt.event.FocusAdapter() {
			public void focusLost(java.awt.event.FocusEvent evt) {
				textFieldUsernameFocusLost(evt);
			}
		});

		PasswordField.setText(GlobalVar.password);
		PasswordField.addFocusListener(new java.awt.event.FocusAdapter() {
			public void focusLost(java.awt.event.FocusEvent evt) {
				PasswordFieldFocusLost(evt);
			}
		});

		CheckBoxSave.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		CheckBoxSave.setForeground(new java.awt.Color(255, 255, 255));
		CheckBoxSave.setSelected(true);
		CheckBoxSave.setText("Запомнить");
		CheckBoxSave.setToolTipText("");
		CheckBoxSave.setOpaque(false);

		ButtonLogin.setText("Играть");
		ButtonLogin.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				ButtonLoginActionPerformed(evt);
			}
		});

		LabelStatus.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
		LabelStatus.setForeground(new java.awt.Color(255, 0, 0));
		LabelStatus.setText("Статус:");
		LabelStatus.setFocusable(false);
		LabelStatus
				.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

		ComboBoxSelectClient.setMaximumRowCount(16);
		ComboBoxSelectClient.setModel(new javax.swing.DefaultComboBoxModel(
				GlobalVar.ClientNames));
		ComboBoxSelectClient.setSelectedIndex(GlobalVar.CurrentServer);
		ComboBoxSelectClient.addItemListener(new java.awt.event.ItemListener() {
			public void itemStateChanged(java.awt.event.ItemEvent evt) {
				ComboBoxSelectClientItemStateChanged(evt);
			}
		});
		getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS));


		LabelStatusText.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
		LabelStatusText.setForeground(new java.awt.Color(255, 0, 0));
		LabelStatusText.setText("Онлайн");
		LabelStatusText.setFocusable(false);
		LabelStatusText
				.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
		TextPaneClientInfo = new javax.swing.JTextPane();
		TextPaneClientInfo.setForeground(Color.WHITE);
		TextPaneClientInfo.setBackground(Color.DARK_GRAY);
		TextPaneClientInfo.setMargin(new Insets(6, 6, 6, 6));
		TextPaneClientInfo.setBorder(null);
		
				TextPaneClientInfo.setEditable(false);
				TextPaneClientInfo.setContentType("text/html"); // NOI18N
				TextPaneClientInfo.setText("<html>" + GlobalVar.clientinfo + "</html>");
		
		CheckBoxShaders = new JCheckBox("Включить шейдеры");
		CheckBoxShaders.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				Boolean res = Utils.setShaderEnable(GlobalVar.itemsServers[GlobalVar.CurrentServer],CheckBoxShaders.isSelected());
				if (!res) {
					Log("Can`t enable shaders");
					CheckBoxShaders.setSelected(false);
				}
			}
		});
		CheckBoxShaders.setOpaque(false);
		CheckBoxShaders.setFont(new Font("Tahoma", Font.BOLD, 11));
		CheckBoxShaders.setForeground(Color.WHITE);

		CheckBoxShaders.setSelected(Utils.getShadersEnable(GlobalVar.itemsServers[GlobalVar.CurrentServer]));
		
		
		comboBoxMemSettings.addItemListener(new ItemListener() {
			public void itemStateChanged(ItemEvent e) {
				if (e.getStateChange() == e.SELECTED) {
				  GlobalVar.clientMemory = comboBoxMemSettings.getSelectedIndex();
				}
			}
		});
		comboBoxMemSettings.setToolTipText("Объем выделенной оперативной памяти");
		comboBoxMemSettings.setModel(new DefaultComboBoxModel(new String[] {"Память - Авто", "Память - 2 Gb", "Память - 3 Gb", "Память - 4 Gb", "Память - 6 Gb"}));
		
		if (GlobalVar.clientMemory < comboBoxMemSettings.getItemCount()) {
			comboBoxMemSettings.setSelectedIndex(GlobalVar.clientMemory);
		} else {
			comboBoxMemSettings.setSelectedIndex(0);
		}
		
		javax.swing.GroupLayout panelControlsLayout = new javax.swing.GroupLayout(
				panelControls);
		panelControlsLayout.setHorizontalGroup(
			panelControlsLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(panelControlsLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(panelControlsLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(TextPaneClientInfo, GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
						.addComponent(CheckBoxShaders)
						.addGroup(panelControlsLayout.createSequentialGroup()
							.addGroup(panelControlsLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(LabelUsername)
								.addComponent(labelPassword))
							.addGap(18)
							.addGroup(panelControlsLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(PasswordField, 146, 146, 146)
								.addComponent(textFieldUsername, 146, 146, 146)))
						.addGroup(panelControlsLayout.createSequentialGroup()
							.addComponent(CheckBoxSave)
							.addGap(26)
							.addComponent(ButtonLogin, GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE))
						.addGroup(panelControlsLayout.createSequentialGroup()
							.addComponent(LabelStatus)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(LabelStatusText, GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE))
						.addComponent(comboBoxMemSettings, 0, 210, Short.MAX_VALUE)
						.addComponent(ComboBoxSelectClient, 0, 210, Short.MAX_VALUE))
					.addContainerGap())
		);
		panelControlsLayout.setVerticalGroup(
			panelControlsLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(panelControlsLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(panelControlsLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(LabelUsername)
						.addComponent(textFieldUsername, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(panelControlsLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(labelPassword)
						.addComponent(PasswordField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(panelControlsLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(ButtonLogin)
						.addComponent(CheckBoxSave))
					.addGap(10)
					.addComponent(CheckBoxShaders)
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addComponent(comboBoxMemSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(panelControlsLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(LabelStatusText, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addComponent(LabelStatus))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(ComboBoxSelectClient, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(TextPaneClientInfo, GroupLayout.PREFERRED_SIZE, 447, GroupLayout.PREFERRED_SIZE)
					.addContainerGap())
		);
		panelControlsLayout.setHonorsVisibility(false);
		panelControls.setLayout(panelControlsLayout);
		
		panelLog = new JPanel();
		GroupLayout gl_PanelMain = new GroupLayout(PanelMain);
		gl_PanelMain.setHorizontalGroup(
			gl_PanelMain.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_PanelMain.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_PanelMain.createParallelGroup(Alignment.LEADING)
						.addComponent(panelNews, GroupLayout.PREFERRED_SIZE, 619, GroupLayout.PREFERRED_SIZE)
						.addComponent(panelLog, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
					.addGap(19)
					.addComponent(panelControls, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
					.addContainerGap())
		);
		gl_PanelMain.setVerticalGroup(
			gl_PanelMain.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_PanelMain.createSequentialGroup()
					.addContainerGap()
					.addGroup(gl_PanelMain.createParallelGroup(Alignment.LEADING)
						.addComponent(panelControls, GroupLayout.PREFERRED_SIZE, 670, GroupLayout.PREFERRED_SIZE)
						.addGroup(gl_PanelMain.createSequentialGroup()
							.addComponent(panelNews, GroupLayout.PREFERRED_SIZE, 538, GroupLayout.PREFERRED_SIZE)
							.addPreferredGap(ComponentPlacement.RELATED)
							.addComponent(panelLog, GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)))
					.addContainerGap())
		);
		panelLog.setLayout(new BoxLayout(panelLog, BoxLayout.X_AXIS));
		
		JScrollPane scrollPane = new JScrollPane();
		panelLog.add(scrollPane);
		textPaneLog.setBackground(Color.DARK_GRAY);
		textPaneLog.setForeground(Color.WHITE);
		
		
		textPaneLog.setEditable(false);
		scrollPane.setViewportView(textPaneLog);
		panelNews.setLayout(new BoxLayout(panelNews, BoxLayout.X_AXIS));
		panelNews.add(jScrollPane2);
		PanelMain.setLayout(gl_PanelMain);
		getContentPane().add(PanelMain);

		pack();
		setLocationRelativeTo(null);
	}// </editor-fold>//GEN-END:initComponents