private void printRainbowUser(User user,String userName,boolean action,SpecialColor type,String id){
  SimpleAttributeSet userStyle=new SimpleAttributeSet(styles.nick());
  userStyle.addAttribute(Attribute.IS_USER_MESSAGE,true);
  userStyle.addAttribute(Attribute.USER,user);
  if (id != null) {
    userStyle.addAttribute(Attribute.ID,id);
  }
  int length=userName.length();
  if (action) {
    print("* ",styles.nick());
  }
  for (int i=0; i < length; i++) {
    Color c;
    if (type == SpecialColor.RAINBOW) {
      c=makeRainbowColor(i,length);
    }
 else {
      c=makeGoldColor(i,length);
    }
    StyleConstants.setForeground(userStyle,c);
    print(userName.substring(i,i + 1),userStyle);
  }
}

private void printRainbowUser ( User user , String userName , boolean action , SpecialColor type , String id ) { SimpleAttributeSet userStyle = new SimpleAttributeSet ( styles . nick ( ) ) ; userStyle . addAttribute ( Attribute . IS_USER_MESSAGE , true ) ; userStyle . addAttribute ( Attribute . USER , user ) ; if ( id != null ) { userStyle . addAttribute ( Attribute . ID , id ) ; } int length = userName . length ( ) ; if ( action ) { print ( "* " , styles . nick ( ) ) ; } for ( int i = 0 ; i < length ; i ++ ) { Color c ; if ( type == SpecialColor . RAINBOW ) { c = makeRainbowColor ( i , length ) ; } else { c = makeGoldColor ( i , length ) ; } StyleConstants . setForeground ( userStyle , c ) ; print ( userName . substring ( i , i + 1 ) , userStyle ) ; } }
output the username in rainbow colors . this means each character has to be output on it ' s own , while changing the color . one style with the appropriate user metadata is used and the color changed . prints the rest ( what doesn ' t belong to the nick itself ) based on the default user style .
