Creating a Windowed Browser

We wrote the indenting parser example to store the display text in an array named displayStrings, so it's easy to display that text in a Java window as we did in the previous chapter. To do that, I'll create a new example named ch12_05.java. In this program, I'll create a new object of a class that I'll call AppFrame, and I'll pass displayStrings and the number of lines to display to the AppFrame class's constructor. Then I'll call the AppFrame object's show method to show the window:

 import java.awt.*; import java.awt.event.*; import org.xml.sax.*; import org.xml.sax.helpers.DefaultHandler; import javax.xml.parsers.*; import java.io.*; public class ch12_05 extends DefaultHandler { . . . public static void main(String ...

Get Real World XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.