www.pudn.com > DomView.zip > DomView.java


/******************************************************************** 
Domview 1.0 displays contents of an XML DOM object 
Copyright (C) 1999  The Bean Factory, LLC. 
 
This program is free software; you can redistribute it and/or 
modify it under the terms of the GNU General Public License 
as published by the Free Software Foundation; either version 2 
of the License, or (at your option) any later version. 
 
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
GNU General Public License for more details. 
 
You should have received a copy of the GNU General Public License 
along with this program; if not, write to the Free Software 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
 
Author: Sun Koh, The Bean Factory, LLC. 
*******************************************************************/ 
import java.awt.*;                  //AWT classes 
import java.awt.event.*;            //AWT event classes 
import java.util.*;                 //Vectors, etc 
import java.io.*;                   //Serializable, etc 
import java.net.*;                  //Network classes  
import javax.swing.*;               //Swing classes 
import javax.swing.event.*;         //Swing events 
import javax.swing.table.*;         //JTable models 
import javax.swing.tree.*;          //JTree models 
import javax.swing.border.*;        //JComponent Borders 
 
/******************************************************************** 
 DomView is a main frame 
 
 
 @version      : 1.0 
 @author       : Sun Koh 
 
********************************************************************/ 
public class DomView 
extends JFrame{ 
// 
// Data Members 
// 
    protected DomViewPanel panel; 
 
    /** 
     Start DomView 
     */ 
    public static void main(String [] args){ 
        new DomView("sun"); 
        new DomView("ibm"); 
        new DomView("openxml"); 
    } 
 
    /** 
     Default constructor 
     */ 
    public DomView(String parser){ 
 
        this.setTitle(":: developerlife.com :: DomView :: " + parser); 
 
        Container c = this.getContentPane(); 
        c.setLayout(new BorderLayout()); 
        //initalize panel and add to it. 
        panel = new DomViewPanel(this, parser); 
        JMenuBar menuBar = new DomViewMenuBar(this); 
        this.setJMenuBar(menuBar); 
         
        c.add(panel, BorderLayout.CENTER); 
 
        this.addWindowListener(new WindowClosing()); 
 
        pack(); 
        show(); 
 
     
    } 
 
    /** 
     Inner class to listen to window actions 
     */ 
    public class WindowClosing extends WindowAdapter{ 
        /** 
         * Invoked when a window is in the process of being closed. 
         * The close operation can be overridden at this point. 
         */ 
        public void windowClosing(WindowEvent e) { 
            System.exit(0); 
        } 
    } 
 
 
 
}//end of DomView class