Session 9 |
Tasks (to be submitted by Sun 15.04 23:55) 1 point
Task 1. Lambda
Try the lambda expression in at least two different cases - different mouse events, different actions (e.g., color change etc.).
Task 2. Button
Write a program that creates a window with a button somewhere in the window. Using the events, the button always has to "jumps away" from the mouse to a random place of the window when the mouse enters the button's region. Ensure that the button does not jump out of the window (even after resizing the window).
Task 3. Test question
Write a program that asks a multi-choice question (with one or more correct answers) and provides a feedback on the answer. Depending on the choice (one or more correct answers), choose the appropriate user interface component to realize it. (The program should use graphical user interface, not the command line.)
Task 4. Tic-tac-toe
Run the tic-tac-toe program and study the code. Some things are commented, but not all of them. Try to understand the overall structure of the program and then study different parts of it: who is doing what.
Here are some guiding questions.
- Which method is executed by the
start
method? What does this method do? - Which methods have been executed by the time the user can make moves on the stage?
- Which parts does the application window consist of? Which JavaFX classes are used to achieve this?
- How is the shape of the game board, the Xs and Os obtained? How can they be changed?
- What method is fired by pressing the Start button? What does this method do?
- ...
It's not necessary to write down anything at home (although, it is possible, of course). Understanding of the program is important. Be ready to answer the questions during practical.
Session 9 |