Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+19 votes

I am looking at MainViewController.java in the MovieTrackerProject. Some of the methods, such as menuActionSaveAs contain the following line:

Window mainWindow = movieWatchListView.getScene().getWindow();

What does this line do?

asked in CSC305 Fall 2023 by (1 point)

2 Answers

+8 votes

This line would retrieve the window that the movieWatchListView is associated with. It gets the scene that the movieWatchListView is a part of and then gets the window that holds that scene. Therefore, mainWindow would now represent the main window of the software. This would be helpful if you wanted to somehow reference that window.

answered by (1 point)
+2 votes

I was confused by this as well, so I asked Dr. Stonedahl. Right now, I have Window mainWindow = displayLesson in use.obtainScene().getWindow(); in my app, the displayLesson is where the cards are displayed.

answered by (1 point)
...