/*
 * -------------------------------------------------------------------------
 *      $Id: HeatmapMain.java,v 1.1 2004/09/15 17:02:04 estewart Exp $
 * -------------------------------------------------------------------------
 *      Copyright (c) 1999 Visual Numerics Inc. All Rights Reserved.
 *
 *      This software is confidential information which is proprietary to
 *      and a trade secret of Visual Numerics, Inc.  Use, duplication or
 *      disclosure is subject to the terms of an appropriate license
 *      agreement.
 *
 *      VISUAL NUMERICS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
 *      SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
 *      BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
 *      FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. VISUAL
 *      NUMERICS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE
 *      AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR
 *      ITS DERIVATIVES.
 *--------------------------------------------------------------------------
 */

/*
 * FittingMain.java
 *
 * Created on August 19, 2003, 4:26 PM
 */

package com.imsl.demo.heatmaps;

import com.imsl.demo.gallery.Describe;

public class HeatmapMain extends javax.swing.JFrame {

    private javax.swing.JTabbedPane jTabbedPane;

    /** Creates a new instance of FittingMain */
    public HeatmapMain(boolean exitOnClose) {
        if (!exitOnClose) {
            // remove the WindowListener,  installed by JFrameChart, that
            // exits the application when the window is closed.
            Object l[] = getListeners(java.awt.event.WindowListener.class);
            for (int k = 0;  k < l.length;  k++) {
                removeWindowListener((java.awt.event.WindowListener)l[k]);
            }
        }
        Describe des = new Describe(this, "/com/imsl/demo/heatmaps/HeatMap.html");
        des.show();
        java.awt.Dimension ds = des.getSize();

        setTitle("Heat Map Examples");
        java.awt.Dimension ss = getToolkit().getScreenSize();
        int w = Math.min(ss.width/2, ss.height-ds.height-32);
        setSize(w, w);
        setLocation(ss.width-ds.width, ds.height);

        initComponents();
    }

    private void reset() {
        repaint();
    }

    private void initComponents() {
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        jTabbedPane = new javax.swing.JTabbedPane();
        jTabbedPane.addTab("Finance", new FPanel(this));
        jTabbedPane.addTab("Biotech", new BPanel(this));
        jTabbedPane.addTab("Engineering", new EPanel(this));
        //jTabbedPane.addTab("", new Panel(this));
        getContentPane().add(jTabbedPane, java.awt.BorderLayout.NORTH);
        jTabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                reset();
            }
        });
    }

    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
        setVisible(false);
        dispose();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        boolean exitOnClose = true;
        if (args.length > 0  && args[0].equals("-noexit"))  exitOnClose = false;
        new HeatmapMain(exitOnClose).show();
    }
}