public void search(String name)
    {
      String searchable = name;
      System.out.println(searchable);
      if(searchable.length() <= 0)
      {
    	  JOptionPane.showMessageDialog(null,"Nothing to search.");
      }
      String doc = t.getText();
      int index = doc.indexOf(searchable,0);
      if(index >= 0 && searchable.length() > 0)
      {
    	try
    	{
    		int end = index + searchable.length();
        		hilit.addHighlight(index, end, painter);
        		t.setCaretPosition(end);
        		JOptionPane.showMessageDialog(null,"'" + searchable + "' found.");
    	}
    	catch (BadLocationException e)
    	{
    		
    	}
      }
      else
      {
          if (searchable.length() > 0)
          {
    	  JOptionPane.showMessageDialog(null,"No results found");
          }
      }
    }