If you want to do the stopwatch using only Timer class then you will need to decide when and how you start it. The textbook starts it immediately but you need to read the textbox and convert the content to an integer variable (say named "count").
The timer cannot be started inside the actionPerformed method since it will work only once but have to be set in some external method so that once started it will call actionPerformed every time it changes to do the updates of the graphics values and manage the count by decrementing it.
Then if you create such external method like:
public void start() { if (count!=0) timer.start( ); }
then inside actionPerformed you need to have two conditions checked:
1. if ( src == “your button” ) then get the text, convert it into an integer count and issue:
start(); ( see the method above)
2. if ( src == timer ) , meaning that timer value has changed since it has been started AFTER the previous condition has been processed, then do the operations on count by decrementing it and updating values necessary for graphics.
Sunday, December 6, 2009
Wednesday, December 2, 2009
About Project...
The min requirements for a completed project include having a working game/simulator with all the mandatory components (see the project description). But this is for marking the project as completed and passing into the final evaluation stage. The grade variance after that will depend on the main grading factors:
User view: visual quality, value-adding supporting services and user-friendliness.
Systems architect view: sophistication of the whole design, good project description (you understand what you did, what was valuable, and what can be improved in the near future).
Programmer view: technical level of implementation.
Therefore, it is up to you to see what level of quality you want to bring your project to. The more good stuff you put in your project the better.
Advice 1: after you have your project satisfying the completion requirements - save it and do not change. Make a copy and enhance the copy only in order to have a working version in case it will stop working during the improvements.
Advice 2 on advanced efforts that can give you some grade enhancement:
1. The design of the game itself. How interesting and user-friendly it is? Do you manage bets, win/loose statistic, other game supporting services?
2. Advanced use of classes (not only for pictures, but may be for separating some operations - like accounting, etc. into a separate class, which communicates with the main interface).
3. Advanced algorithm elements like some intelligence allowing the computer to play against human (just a bunch of IF-ELSE statements).
4. Threads, including animations.
5. Good user input validation (like what happens if instead of a number they type in a letter, etc.)
6. Visually nice layout of the playfield, buttons and other components.
7. Good internal structure of the program with methods representing logically separate parts of program logic and other methods calling them when necessary. Absence of repetitive operations that could have been done with loops. Sufficient commentary in the program text.
8. Good paper explaining your project, the game, the approach used, the advanced methods, etc. - showing all the best and important that you have and making your project well understood.
User view: visual quality, value-adding supporting services and user-friendliness.
Systems architect view: sophistication of the whole design, good project description (you understand what you did, what was valuable, and what can be improved in the near future).
Programmer view: technical level of implementation.
Therefore, it is up to you to see what level of quality you want to bring your project to. The more good stuff you put in your project the better.
Advice 1: after you have your project satisfying the completion requirements - save it and do not change. Make a copy and enhance the copy only in order to have a working version in case it will stop working during the improvements.
Advice 2 on advanced efforts that can give you some grade enhancement:
1. The design of the game itself. How interesting and user-friendly it is? Do you manage bets, win/loose statistic, other game supporting services?
2. Advanced use of classes (not only for pictures, but may be for separating some operations - like accounting, etc. into a separate class, which communicates with the main interface).
3. Advanced algorithm elements like some intelligence allowing the computer to play against human (just a bunch of IF-ELSE statements).
4. Threads, including animations.
5. Good user input validation (like what happens if instead of a number they type in a letter, etc.)
6. Visually nice layout of the playfield, buttons and other components.
7. Good internal structure of the program with methods representing logically separate parts of program logic and other methods calling them when necessary. Absence of repetitive operations that could have been done with loops. Sufficient commentary in the program text.
8. Good paper explaining your project, the game, the approach used, the advanced methods, etc. - showing all the best and important that you have and making your project well understood.
Subscribe to:
Comments (Atom)
