My guess is the problem lies outside the code you posted. Where are you calling this code: from a loop? In the event dispatching thread?