Results 1 to 3 of 3
  1. #1
    Windoze is offline Member
    Join Date
    Nov 2007
    Rep Power

    Default Pauses (or delays rather....)

    Hey i was wondering if anyone knew how to make the code pause for a specified interval of time, at any place in the code that you place it.

    thank you in advance.

  2. #2
    lk9865 is offline Member
    Join Date
    Nov 2007
    Rep Power


    Which IDE are you using?
    if you are using Netbeans then what you can do is click on the line number once and you will see a red square pop up and then you can click on run->debug
    it will run the program up until the red square and then you can click on play button to run the program line by line

  3. #3
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    You have two choices:
    1 — use a Swing Timer with non-repeating delay, ie, one–time use. There's a page in the tutorial that discusses the use of Swing Timers: How to Use Swing Timers.
    2 — use a thread:
    Java Code:
    Thread thread = new Thread(new Runnable() {
        public void run() {
            try {
            } catch(InterruptedException e) {
    This will halt everything: gui response, gui updates, etc; the app will appear to freeze.

Similar Threads

  1. Delays by Play announcements
    By koni123 in forum Java Software
    Replies: 0
    Last Post: 01-08-2008, 10:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts