428 9 Chapter 20: Visualization: Views and Windows
1. Get a reference to the view into which it is to be placed.
2. Create the new view.
3. Add it.
The relevant lines of code are underlined in the following
code snippets. The only item that needs to be pointed out is
that it is common in finding a reference to the view to be add-
ed to that it may need to be fished through some intermediate
views. In this case, the object that is adding the page has a ref-
erence to a scroll view, and it needs to retrieve a document
view object from that one.
Java:
public void addPage() {
int numberOfPages = numberOfPages();
MultiplePaqeView ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.