/* * MainFrame.java * * Created on September 19, 2001, 2:47 PM */ package com.imsl.demo.StockChart; /** * * @author brophy */ public class MainFrame extends javax.swing.JFrame { private ChartPanel chartPanel; /** Creates new form MainFrame */ public MainFrame() { initComponents(); chartPanel = new ChartPanel(); getContentPane().add(chartPanel, java.awt.BorderLayout.CENTER); pack(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ private void initComponents() {//GEN-BEGIN:initComponents jMenuBar = new javax.swing.JMenuBar(); jMenuFile = new javax.swing.JMenu(); jMenuItemPrint = new javax.swing.JMenuItem(); jSeparator1 = new javax.swing.JSeparator(); jMenuItemExit = new javax.swing.JMenuItem(); jMenuView = new javax.swing.JMenu(); jCheckBoxMenuItemMovingAverage = new javax.swing.JCheckBoxMenuItem(); jMenuFile.setText("File"); jMenuFile.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuFileActionPerformed(evt); } }); jMenuItemPrint.setText("Print..."); jMenuItemPrint.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemPrintActionPerformed(evt); } }); jMenuFile.add(jMenuItemPrint); jMenuFile.add(jSeparator1); jMenuItemExit.setText("Exit"); jMenuItemExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemExitActionPerformed(evt); } }); jMenuFile.add(jMenuItemExit); jMenuBar.add(jMenuFile); jMenuView.setText("View"); jCheckBoxMenuItemMovingAverage.setSelected(true); jCheckBoxMenuItemMovingAverage.setText("Moving Average"); jCheckBoxMenuItemMovingAverage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBoxMenuItemMovingAverageActionPerformed(evt); } }); jMenuView.add(jCheckBoxMenuItemMovingAverage); jMenuBar.add(jMenuView); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { exitForm(evt); } }); setJMenuBar(jMenuBar); pack(); }//GEN-END:initComponents private void jCheckBoxMenuItemMovingAverageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMenuItemMovingAverageActionPerformed chartPanel.setViewMovingAverage(jCheckBoxMenuItemMovingAverage.getState()); }//GEN-LAST:event_jCheckBoxMenuItemMovingAverageActionPerformed private void jMenuItemExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemExitActionPerformed exitForm(null); }//GEN-LAST:event_jMenuItemExitActionPerformed private void jMenuFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuFileActionPerformed // Add your handling code here: }//GEN-LAST:event_jMenuFileActionPerformed private void jMenuItemPrintActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemPrintActionPerformed chartPanel.print(); }//GEN-LAST:event_jMenuItemPrintActionPerformed /** Exit the Application */ private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm System.exit(0); }//GEN-LAST:event_exitForm /** * @param args the command line arguments */ public static void main(String args[]) { new MainFrame().show(); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenuBar jMenuBar; private javax.swing.JMenu jMenuFile; private javax.swing.JMenuItem jMenuItemPrint; private javax.swing.JSeparator jSeparator1; private javax.swing.JMenuItem jMenuItemExit; private javax.swing.JMenu jMenuView; private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItemMovingAverage; // End of variables declaration//GEN-END:variables }