Hi, in my java project Employee Payroll, I am supposed to include a Ideal-Time window and maintain log for that ideal time for particular Employee... On the basis of which salary deduction or bonus to the employee will be calculated...

For maintaining log, we will need JDBC; but for creating Ideal time window.. asking user why he didn't work for ideal time if it is more than 1hr, what should we do?? Do we need applets for that???

Hi, in my java project Employee Payroll, I am supposed to include a Ideal-Time window and maintain log for that ideal time for particular Employee... On the basis of which salary deduction or bonus to the employee will be calculated...

For maintaining log, we will need JDBC; but for creating Ideal time window.. asking user why he didn't work for ideal time if it is more than 1hr, what should we do?? Do we need applets for that???

To clarify... will you need to maintain a log on the JDBC connection which will see what changes the employee is making to the database and if he hasnt made changes for x amount of time it must alert him?

To clarify... will you need to maintain a log on the JDBC connection which will see what changes the employee is making to the database and if he hasnt made changes for x amount of time it must alert him?

yahh, actually the system will work on mouse and keyboard interface.. If the employee is present on some working day and after his 1st log-in if, he is not touching his system for some definite amt of time ; then on resuming the system will display an Ideal time log window and until and unless employee providing his log-in ID-Password and reason for ideal-time, the ideal-time system won't allow him to work on his own panel..

yahh, actually the system will work on mouse and keyboard interface.. If the employee is present on some working day and after his 1st log-in if, he is not touching his system for some definite amt of time ; then on resuming the system will display an Ideal time log window and until and unless employee providing his log-in ID-Password and reason for ideal-time, the ideal-time system won't allow him to work on his own panel..

well i would then add a keybinder and mouse motion listener for the panel... this will detect movement and keys pressed when in focus of the panel. then you could monitor this either by writing all keys and movements to a file with a time and date stamp. and when a movement or key is pressed it will call a method to start timing and the same method will start and stop the timer each time it is called respectively and therefor allwong it to calculate elspased time between movements and keys, then prompt either he took to long or just let him work? here is something for the getting of the time:http://www.mkyong.com/java/java-how-to-get-current-date-time-date-and-calender/ also look at the method of currentTimeMillis here:http://docs.oracle.com/javase/7/docs/api/java/lang/System.html and here is tutorial from java on keybinders and mouse motion listners: http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html , http://docs.oracle.com/javase/tutorial/uiswing/events/mousemotionlistener.html.

some psuedo logic for the timer might be(note checkTime would be called when ever movement or keys are pressed):

static boolean isTiming=false;
static int time=0,MAX_ALLOWED=90;
checkTime() {//main method that will be called for all movements
    if(isTiming) {//will check if it has already started timing

    boolean aboveThreshold=calcTime();//will then call a method that will return true or false dpending on how long the user took
    if(aboveThreshold) {//if he took too long
    //here the user will be prompted why he hasnt been working for the time or whatever
    } else {
    //do nothing it was within the time limit
    }
} else {//it wasnt already timing
    time=getTime();
    isTiming=true;
}
}//end of method

boolean calcTime() {
    if(getCurTime()-time>MAX_ALLOWED) {//variable time holds the last time it saved. get time will get the current time and will check if its above or below the threshhold
        return true;
    } else {
        return false;
    }
}
commented: Thanks for the links, learned a lot more :) +6

well i would then add a keybinder and mouse motion listner for the panel... this will detect movement and keys pressed when in focus of the panel. then you could monitor this either by writing all keys and movements to a file with a time and date stamp. then you would wait until no input is being made and begin timing by getting the current time and when a movement or key is pressed it will stop and check the time? here is something fot the getting of the time:http://www.mkyong.com/java/java-how-to-get-current-date-time-date-and-calender/ and here is tutorial from java on keybinders and mouse motion listners: http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html , http://docs.oracle.com/javase/tutorial/uiswing/events/mousemotionlistener.html.

Thanx for the help.... Also suggest more ideas if you have it ! :)

Thanx for the help.... Also suggest more ideas if you have it ! :)

please see edited post above

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.