private void updateTable() {
		int update_count = 0;
		int table_length = model.getRowCount();
		
		//Check all groups
		for (ThreadGroup g: group) {
			
			Thread[] tmp = new Thread[g.activeCount()];
			g.enumerate(tmp);
			
			//Check all threads
			for (Thread t : tmp) {
				
				//If that thread is not in our list then...
				if (!threads.contains(t)) {
					update_count++;
					threads.add(t);
					thread_states.put(t.hashCode(), t.getState());
					
					//Row values to be inserted in the table
					String[] row = new String[5];
					row[0] = t.getName();
					row[1] = t.getThreadGroup().getName();
					row[2] = Integer.toString(t.getPriority());
					row[3] = Long.toString(t.getId());
					row[4] = t.getState().toString();
					
					addTableColor(t);	//Set color
					model.addRow(row);	//Add row
				}
			}
		}
		
		//Refreshes table for new values only
		model.fireTableRowsInserted(table_length, update_count);
		
		
		//Check all the threads for updated states
		for (int i=0; i<threads.size(); i++) {
			Thread tmp = threads.get(i);
			
			State old = thread_states.get(tmp.hashCode());
			State nw = tmp.getState();
			
			//If new state does not equal old
			if (nw != old) {
				//Replace it with new state in hash table
				thread_states.replace(tmp.hashCode(), old, nw);
				
				//Update the color for the row
				updateTableColor(tmp,i);
			
				//Update table and redraw row
				model.setValueAt(nw.toString(), i, 4);
				model.fireTableRowsUpdated(i, i);
			}
		}	
	}