public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
Container contentPane = getContentPane();
pane.setLayout(new BorderLayout());
// Add the menubar
menuBar = new TestMenuBar(this);
setJMenuBar(menuBar);
// Get the Graphics object for pdf writing
Graphics pdfGraphics = null;
job = new PDFJob(fileOutputStream);
pdfGraphics = job.getGraphics();
Dimension d = job.getPageDimension();
documentDimension = d;
// Finish setting up the window and bring to front
int w = (int)d.getWidth();
int h = (int)d.getHeight();
drawingArea = new TestPanel();
// Put the drawing area in a scroll pane
JScrollPane scrollPane = new JScrollPane(drawingArea,
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
// Set the preferred size bigger than the scroll pane so the bars show up
drawingArea.setPreferredSize(new Dimension(1000, 1000));
pane.add(scrollPane, "Center");
contentPane.add(pane);
setTitle("PDF Test Application");
// Set the location and size of the window and show it
Toolkit toolkit = Toolkit.getDefaultToolkit();