In future, while posting code, please
UseCodeTags. I have added them this time for you. As you can see the tags make the code much more easier to read and understand.
From what information you have shared, your problem is related to the query and not Swing per se. I will move this topic over to a more appropriate forum,