{
if(currentIconSet != null)
{//no icons selected
for(int i=0;i<wordList.size();i++)
{
Word word =(Word) wordList.get(i);
String token = word.word;
if(token.length()>1)
{
//System.out.println(token);
//System.out.println(i);
for(Iterator j=currentIconSet.iterator();j.hasNext();)
{
//Map.Entry entry =(Map.Entry) j.next();
Emoticon emoticon = (Emoticon)j.next();
String toCheck = emoticon.toString();
if (token.equals(toCheck))
{
setIcon(sas,emoticon);
word.addAttributes(sas);
break;
}
else if (token.startsWith(toCheck))
{
word.word = "o";
setIcon(sas,emoticon);
word.addAttributes(sas);
//split smiley and word
wordList.add(i+1,new Word(" "));
wordList.add(i+2,new Word(token.substring(toCheck.length())));
i++;//don't check inserted space
break;
}
else if (token.endsWith(toCheck))
{
word.word = token.substring(0,token.length()-toCheck.length());
//split smiley and word
wordList.add(i+1,new Word(" "));
setIcon(sas,emoticon);
wordList.add(i+2,new Word("o",(SimpleAttributeSet)sas.clone()));
i--;//check if there was another smiley in front
break;
}
}
}