Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using XML Transviewer Beans, 15 of 15

## Transviewer Bean Example 3: XMLTransformPanelSample.java

This example is an interactive application that uses XMLTransformPanel Bean to do the following:

- Generate XML from database queries

- Transform the XML using XSL styelsheets

- View the results

- Store the results in CLOB tables in the database

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      import oracle.xml.transviewer.XMLTransformPanel;

      public class XMLTransformPanelSample
      {
        XMLTransformPanel transformPanel = new XMLTransformPanel();

        /**
         * Adjust frame size and add transformPanel to it.
         */
        public XMLTransformPanelSample ()
        {
          Frame     frame      = new JFrame();
          Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
          frame.setSize(510,550);
          transformPanel.setPreferredSize(new Dimension(510,550));
          Dimension frameSize = frame.getSize();

          if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
          }
          if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
          }
          frame.setLocation ((screenSize.width - frameSize.width)/2,
                            (screenSize.height - frameSize.height)/2);
          frame.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent e) { System.exit(0); }
          });
          frame.setVisible(true);

          ((JFrame)frame).getContentPane().add (transformPanel);
          frame.pack();
        }

        /**
         *  main(). Only creates XMLTransformPanelSample object.
         */
        public static void main (String[] args)
        {
          new XMLTransformPanelSample ();
        }
      }

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index