Creating a Windowed Browser
Converting the code we've written to display a document in a window isn't difficult because that code was purposely written to store the output in an array of strings and because I can display those strings in a Java window. In this example, I'll upgrade that code to a new program, browser.java, that will use Java to display XML documents in a window.
Here's how it works. I start by parsing the document the user wants to parse in the main method:
public static void main(String args[]) { displayDocument(args[0]); . . .
Then I'll create a new window using the techniques we saw in the previous chapter. Specifically, I'll create a new class named AppFrame, create an object of that class, and display it:
public static ...
Get Real World XML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.