Institute of Computer Science
  1. Courses
  2. 2017/18 spring
  3. Object-Oriented Programming (Narva College) (P2NC.01.083)
ET
Log in

Object-Oriented Programming (Narva College) 2017/18 spring

  • Home
  • Materials
  • Java Glossary
  • Source Example
  • Cheat sheet (S1-S6)
  • Grading
  • Links
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 
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment