title: Java string replaceAll()
body: <p>I've been wondering if for example:</p>
  
  <pre><code>    JTextPane chatTextArea = new JTextPane();
      s.replaceAll(":\\)", emoticon());
  
      public String emoticon(){
             chatTextArea.insertIcon(new ImageIcon(ChatFrame.class.getResource("/smile.png")));
             return "`";
         }
  </code></pre>
  
  <p>can put a picture and a "`" everywhere ":)" is found. When I run it like this if s contains a ":)" then the whole s gets replaced just by the icon.
  Is there a way to do it?</p>