@Override
	public void actionPerformed(ActionEvent ae) 
	{
		for(int i=0;i<tempStudentLinkedList.size();i++)
		{
			
			if(ae.getSource()==tempAddButtonList.get(i))
			{
				System.out.println("You Found A button was clicked in the waiting Dialog For Text");
				
				new GeneralDialogBox(sf, tempStudentLinkedList.get(i)).setVisible(true);
				Student.studentListText.remove(tempStudentLinkedList.get(i));
				sf.updateTextPanel();
				
				//tempStudentLinkedList.remove(i);
				
				tempStudentLinkedList = new LinkedList();
				tempAddButtonList=new LinkedList();
				tempDeleteButtonList=new LinkedList();
				for(int j=0;j<Student.studentListText.size();j++)
				{
					Student currentStudent=Student.studentListText.get(j);
					if(currentStudent.studentName.indexOf(searchField.getText())!=-1 || currentStudent.doubtSubject.indexOf(searchField.getText())!=-1)
					{
						JButton tickButton=new JButton("\u2714");
						JButton crossButton=new JButton("X");
						tickButton.addActionListener(this);
						crossButton.addActionListener(this);
						//ServerFrame.methodToAddActionListener(tickButton);
						//ServerFrame.methodToAddActionListener(crossButton);
						
						tempAddButtonList.add(tickButton);
						tempDeleteButtonList.add(crossButton);
						
						tempStudentLinkedList.add(currentStudent);
					}
				}
				addStudentInSearchPanel(tempStudentLinkedList);
				System.out.println("size of tempStudentLinkedList = "+tempStudentLinkedList.size());
				
				searchField.requestFocus();
			
			}
			else if(ae.getSource()==tempDeleteButtonList.get(i))
			{
				Student.studentListText.remove(tempStudentLinkedList.get(i));
				sf.updateTextPanel();
				
				//tempStudentLinkedList.remove(i);
				
				tempStudentLinkedList = new LinkedList();
				tempAddButtonList=new LinkedList();
				tempDeleteButtonList=new LinkedList();
				for(int j=0;j<Student.studentListText.size();j++)
				{
					Student currentStudent=Student.studentListText.get(j);
					if(currentStudent.studentName.indexOf(searchField.getText())!=-1 || currentStudent.doubtSubject.indexOf(searchField.getText())!=-1)
					{
						JButton tickButton=new JButton("\u2714");
						JButton crossButton=new JButton("X");
						tickButton.addActionListener(this);
						crossButton.addActionListener(this);
						//ServerFrame.methodToAddActionListener(tickButton);
						//ServerFrame.methodToAddActionListener(crossButton);
						
						tempAddButtonList.add(tickButton);
						tempDeleteButtonList.add(crossButton);
						
						tempStudentLinkedList.add(currentStudent);
					}
				}
				addStudentInSearchPanel(tempStudentLinkedList);
				System.out.println("size of tempStudentLinkedList = "+tempStudentLinkedList.size());
				
				searchField.requestFocus();
			
			}
		}
		
		/*
		// TODO Auto-generated method stub
		for(int i=0;i<Student.studentListText.size();i++)
		{
			if(ae.getSource()==tempAddButtonList.get(i))
			{
				new GeneralDialogBox(sf, tempStudentLinkedList.get(i)).setVisible(true);
				Student.studentListText.remove(i);
				
				//studentPanel.setVisible(false);
				textPanel.removeAll();
				studentMsg.removeAll();
				studentMsg=new JPanel();
				if(Integer.parseInt(studentNumberComboBox.getSelectedItem().toString())<5)
					studentMsg.setLayout(new GridLayout(5,1,10,10));
				else
					//studentPanel.setLayout(new GridLayout(Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()),1,10,10));
				studentMsg.setLayout(new BoxLayout(studentMsg, BoxLayout.Y_AXIS));
				//studentPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
				
				studentMsg.setBackground(Color.white);
			
				for(int j=0;j<Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()) && j<Student.studentListText.size();j++)
					studentMsg.add(createStudentTextMsgPanel(j,Student.studentListText.get(j)));
				
				//audioPanel.add(studentPanel,BorderLayout.CENTER);
				textPanel.add(new JScrollPane(studentMsg),BorderLayout.CENTER);
				
				textPanel.setBackground(Color.WHITE);
				
				if(tabbedPane.getSelectedIndex()==0 && (Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()))>=0)
					waitingButton.setText("Waiting : "+(Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString())));
				else if(tabbedPane.getSelectedIndex()==1 && (Student.studentListText.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()))>=0)
					waitingButton.setText("Waiting : "+(Student.studentListText.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString())));
				else 
					waitingButton.setText("Waiting : 0");
				return;
			
			}
			if(ae.getSource()==deleteButtonText.get(i))
			{
				Student.studentListText.remove(i);
				
				//studentPanel.setVisible(false);
				textPanel.removeAll();
				studentMsg.removeAll();
				studentMsg=new JPanel();
				if(Integer.parseInt(studentNumberComboBox.getSelectedItem().toString())<5)
					studentMsg.setLayout(new GridLayout(5,1,10,10));
				else
					//studentPanel.setLayout(new GridLayout(Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()),1,10,10));
				studentMsg.setLayout(new BoxLayout(studentMsg, BoxLayout.Y_AXIS));
				//studentPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
				
				studentMsg.setBackground(Color.white);
			
				for(int j=0;j<Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()) && j<Student.studentListText.size();j++)
					studentMsg.add(createStudentTextMsgPanel(j,Student.studentListText.get(j)));
				
				//audioPanel.add(studentPanel,BorderLayout.CENTER);
				textPanel.add(new JScrollPane(studentMsg),BorderLayout.CENTER);
				
				textPanel.setBackground(Color.WHITE);
				if(tabbedPane.getSelectedIndex()==0 && (Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()))>=0)
					waitingButton.setText("Waiting : "+(Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString())));
				else if(tabbedPane.getSelectedIndex()==1 && (Student.studentListText.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()))>=0)
					waitingButton.setText("Waiting : "+(Student.studentListText.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString())));
				else 
					waitingButton.setText("Waiting : 0");
				return;
			}
			
		}
	*/	
	}