Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
  1. #21
    infinity is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    i implemented the timer

    so there are two conditions for this process
    1) while the user hasn't switched it off with the button
    2) while the process occurs under a certain amount of times(set by the user prior to clicking on the button)

    the timer works fine with the first condition, but there is no way to control the second condition(since you can only make it start and stop)

    and i'm going to try this with the button, so forget key binding


    so yeah, i'm going to manually thread it then
    Last edited by infinity; 04-09-2009 at 01:49 AM.

  2. #22
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    You could implement a counter that stops the timer after the specified number of firings. Something like
    Java Code:
    int counter = 0;
    int limit;
    
    public void actionPerformed() {
        counter++;
        if (counter >= limit) {
            timer.stop();
        }
        // blah
    }
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  3. #23
    infinity is offline Member
    Join Date
    Jan 2009
    Posts
    14
    Rep Power
    0

    Default

    nevermind, i'm an idiot
    Last edited by infinity; 04-09-2009 at 02:35 AM.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Key event
    By ivvgangadhar in forum Threads and Synchronization
    Replies: 1
    Last Post: 12-11-2008, 10:27 AM
  2. MouseDragged Event
    By Preethi in forum New To Java
    Replies: 1
    Last Post: 03-04-2008, 06:09 AM
  3. Event
    By nt5515 in forum New To Java
    Replies: 0
    Last Post: 02-15-2008, 05:44 PM
  4. Listener for SWT event
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-08-2008, 10:04 AM
  5. SWT Event Handling
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-30-2007, 01:21 PM

Posting Permissions

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