0

I did a program that connecting to database then show data and user can ( add or remove or update ) data but my problem that program take a little time to be ready how i can know that time and make notification for user to use program now or wait (Program still in loading)

4
Contributors
8
Replies
9
Views
6 Years
Discussion Span
Last Post by mohamed moamen
0
long start = System.currentTimeMillis();
long end = 0l;
long elapsed = 0l;

// your code

end = System.currentTimeMillis();
elapsed = end - start;
System.out.println(("Search Spent " + ((int) (elapsed / 1000)) + " seconds");

but some Java Gurus told that System.nanoTime(); is more precious

0

thnx but i do my program using swing controllers and jframeform where i can but this code to calculate all the program time that need to be ready

0

what you really needed

1) calculate time between two periods,
2) pre-calculate required time and to display that in JProgressBar
3) or entertain the audience (in some way) during the the program works, rotated Icon, change Cursor, diplay some notice...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.