A couple hints on how to make it easier for others to help you:
Please UseCodeTags when posting code of any length (I have added those now for you). It's unnecessarily hard to read the code otherwise, making it less likely that people will do so.
Also, you can make it much easier on others by posting an SSCCE - that means including all necessary imports. If people have to figure those out by themselves, it's much less likely they will bother to do so. You can edit your post to add the imports by using the button.