public synchronized void drawPopUps()
	{
		
		try
		{
			
			CoreClass.dialogSemaphore.acquire();
			
		} 
		catch (InterruptedException e)
		{
			
			e.printStackTrace();
			
		}
		
		Set<PopUps> temp = Collections.unmodifiableSet(CoreClass.notifications);
		
			g.setColor(Color.BLACK);
		
			for(PopUps p: temp)
			{
				
				if(p instanceof DialogBox)
				{

					g.setFont(p.getFont());
					
					if(g.getFontMetrics().stringWidth(p.getS()) < 500)
					{
					
						g.drawImage(p.getPic(), p.getX(), p.getY()  - p.getPic().getHeight(null), null);
	
						
						ArrayList<String> sa = new ArrayList<String>(Arrays.asList( p.getS().split(" ")));
						
						ArrayList<String> lines = new ArrayList<String>();
						
						
						int total = 0;
						
						String s = "";
					
							//break down sentence into words and organize it to fit in the word bubble
							while(sa.size() > 0)
							{
								
								int part = g.getFontMetrics().stringWidth(sa.get(0));
								
									if(total + part <= 160)
									{
										
										total = total + part;
										
										s = s + " " + sa.get(0);
										
										sa.remove(0);
										
											if(sa.size() == 0)
											{
												lines.add(s);
											}
										
									}	
									else
									{
										
										lines.add(s);
										
											s = "";
											total = 0;
										
									}
			
							}
					
					
								int line = 30;
								for(String st:lines)
								{
									
									g.drawString(st, p.getX() + 10, p.getY() - p.getPic().getHeight(null) + line);
									
										line = line + 30;
									
								}

				}
					
			}
					
		}
		
		CoreClass.dialogSemaphore.release();
	}