Institute of Computer Science
  1. Courses
  2. 2019/20 spring
  3. Object-Oriented Programming (Narva College) (LTAT.NR.003)
ET
Log in

Object-Oriented Programming (Narva College) 2019/20 spring

  • Home
  • Materials
  • Grading
  • Java Glossary
  • Cheat sheet (S1-S6)
  • Source Example
  • Links

Task 1. Position of the mouse

Write a program which shows the position (coordinates x and y) of the mouse when the mouse button is pressed. The information must be placed at the same place where the mouse button has been pressed. Once the mouse button is released, the information must disappear.

Example of the output:

Task 2. Flag

Upgrade the flag program of the last home assignment as follows. If the window is resized using the mouse, the flag has to be resized accordingly.

Hints: There is no particular event for resizing the window; therefore, apply the change listener to the stage properties (widthProperty and heightProperty). Create a method for the canvas drawing and call it when the size of the window is changed. Bind the size of the canvas with the size of the window using the method bind() (e.g. myCanvas.widthProperty().bind(myStage.widthProperty());). More info about binding is here.

Task 3. Calculator

Write a program which creates a calculator window. Add event handlers. All buttons must function.

Example of the output:

  • 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