Chapter 8 |
Tasks (to be submitted by 6.04)
Task 1. Lambda
Try the lambda expression in at least two different cases - different mouse events, different actions (e.g., color change, etc.). Submit the java file into Moodle.
Task 2. Button
Write a program that creates a window with a button. Add events so that when the mouse enters the button's region, the button "jumps away" from the mouse to a random place of the window. 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. Depending on the choice (one or more correct answers), choose an 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 these and some more extra questions during the session.
Chapter 8 |