I want my timer to execute the actionPerformed method only one time once it 5 seconds the time but it is writing in the console \"Hello\" lots of times:
import j
Sounds like you want a java.util.Timer rather than a javax.swing.Timer.
java.util.Timer
javax.swing.Timer