Results 1 to 3 of 3
  1. #1
    kosok is offline Member
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

    Default [SOLVED]Alphabet timer help.

    I'm creating a program that times the user on how fast they can enter the alphabet. I also want to tell the user between which two letters the greatest time gap was. The method i'm trying now involves taking the difference, and then at next keyevent takes the difference of the two differences and only stores the greater one.

    here is the code i'm trying:
    Java Code:
    			if(first==0)
    			{
    				first=ke.getWhen();
    				System.out.println("Initial first: "+first);
    			}
    			else
    			{
    				second=ke.getWhen();
    				System.out.println("Initial second: "+second);
    			}
    			if(second!=0 && time==0)
    			{
    				time=second-first;
    				System.out.println("Initial time: "+time);
    			}
    			if(time!=0 && secondTime==0)
    			{
    				buffer=second;
    				second=ke.getWhen();
    				first=buffer;
    				secondTime=second-first;
    				System.out.println("Second time: "+secondTime);
    			}
    			if(secondTime>time)
    			{
    				time=secondTime;
    				secondTime=0;
    				System.out.println("Time again "+time);
    			}
    ke is my KeyEvent, and all my variables are long with initial value of 0.
    Last edited by kosok; 12-24-2008 at 06:06 PM. Reason: solved

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

  3. #3
    kosok is offline Member
    Join Date
    Dec 2008
    Posts
    4
    Rep Power
    0

Similar Threads

  1. Best way to implement a timer
    By Nuluvius in forum New To Java
    Replies: 11
    Last Post: 01-16-2009, 01:27 AM
  2. Listing the alphabet (beginner)
    By SuperOnion in forum New To Java
    Replies: 3
    Last Post: 12-22-2008, 03:23 AM
  3. EJB Timer
    By mrjunsy in forum Advanced Java
    Replies: 0
    Last Post: 08-22-2008, 04:09 PM
  4. EJB Timer
    By mrjunsy in forum New To Java
    Replies: 0
    Last Post: 08-04-2008, 06:47 PM
  5. Replies: 0
    Last Post: 04-04-2008, 02:46 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
  •