/**
 * Name: Edison Chindrawaly
 * File: GenerateScript.java
 * Desc: These file is the main file. GenerateScript has
 *       three supports files: MyGenerateScript, DialogLayout,
 *       and Execute. The purpose of GenerateScript is to
 *       generate script (*.sh) for running DDM (Data Distrubtion
 *       Management) part of RTI-Kit.
 * Date: Aug 9, 2001
 * Vers: 1.2
 */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;

public class GenerateScript extends JFrame
{
 JDesktopPane desktop;

/**
 * default constructor
 */
 public GenerateScript()
 {
  super("Script Generator");
  int inset = 100;
  Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  setBounds(inset, inset,
          screenSize.width - inset * 2,
            screenSize.height- inset * 2);
  addWindowListener(new WindowAdapter()
  {
   public void windowClosing(WindowEvent e)
   {
    System.exit(0);
   }
  });
  desktop = new JDesktopPane();
  createFrame();
  setContentPane(desktop);
  setJMenuBar(createMenuBar());
  desktop.putClientProperty("JDesktopPane.dragMode","outline");
 }

/**
 * createMenuBar's method is to create Menu Bar for
 * JFrame, and for right now the keyboard's action is not
 * fully implement. Meaning, the keyboard short cut is not
 * working because it is not implemented yet.
 * @param  none
 * @return none
 */
 protected JMenuBar createMenuBar()
 {
  JMenuBar menuBar = new JMenuBar();
  JMenu menu = new JMenu("File");
  menu.setMnemonic(KeyEvent.VK_F);
  JMenuItem menuNew = new JMenuItem("New");
  JMenuItem menuOpen= new JMenuItem("Open");
  JMenuItem menuExit= new JMenuItem("Exit");
  menuNew.setMnemonic(KeyEvent.VK_N);
  menuOpen.setMnemonic(KeyEvent.VK_O);
  menuExit.setMnemonic(KeyEvent.VK_E);
  menuNew.addActionListener(new ActionListener()
  {
   public void actionPerformed(ActionEvent e)
   {
    createFrame();
   }
  });
  menuExit.addActionListener(new ActionListener()
  {
   public void actionPerformed(ActionEvent e)
   {
    System.exit(0);
   }
  });
  menuOpen.addActionListener(new ActionListener()
  {
   // It is not fully implement
   public void actionPerformed(ActionEvent e)
   { System.out.println("Open");
    //new FileHandler();
   }
  });
  menu.add(menuNew);
  menu.add(menuOpen);
  menu.add(menuExit);
  menuBar.add(menu);
  return menuBar;
 }

/**
 * createFrame's method is to create the Internal Frame
 * in the desktop area.
 * @param  none
 * @return none
 */
 protected void createFrame()
 {
  MyGenerateScript frame = new MyGenerateScript();
  frame.setVisible(true);
  desktop.add(frame);
  try
  {
   frame.setSelected(true);
  }
  catch(java.beans.PropertyVetoException e)
  { }
 }

/**
 * main's method is the driver method
 */
 public static void main(String[] args)
 {
  GenerateScript frame = new GenerateScript();
  frame.setVisible(true);
 }
}
 

1