First of all Swing related questions should be posted in the Swing forum.
Secondly, be patient you just posted the question 30 minutes ago. Instead of sitting around waiting for an answer why don't you use the time to read the API. Take a look at the "get" methods and you will find one you can use.