scias23 1 Junior Poster in Training

WHAT i want to happen is, when i click the CALCULATOR menu item, my separate Calculator.java will run on the MenuShortCut JFrame.

AGAIN, i want the separate .java file to appear on THE SAME JFrame of MenuShortCut class.

here's what i've got

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

public class MenuShortcut extends JFrame implements ActionListener{
    JMenuBar menuBar;
    JMenu files,help;
    JMenuItem cs[],calc,game,exit,about;

    public MenuShortcut() {
        super("Team Shrek");
        menuBar = new JMenuBar();
        files = new JMenu("File");
        help = new JMenu("Help");
        cs = new JMenuItem[5];
        calc = new JMenuItem("Calculator");
        game = new JMenuItem("Word Game");
        exit = new JMenuItem("Exit");
        about = new JMenuItem("About");

        for(int i=0;i<5;i++) {
            cs[i] = new JMenuItem("CaseStudy "+(i+1));
            cs[i].addActionListener(this);
            files.add(cs[i]);
        }
        files.addSeparator();
        files.add(calc);
        files.add(game);
        files.addSeparator();
        files.add(exit);

        help.add(about);

        menuBar.add(files);
        menuBar.add(help);

        setJMenuBar(menuBar);

        setSize(250,200);
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    public static void main(String[] args) {
        new MenuShortcut();
    }

    public void actionPerformed(ActionEvent e) {
        //some events here
    }
}

can i do that using this?

Runtime.getRuntime().exec( "java programname.java" );

if yes, codes do i need to add in order to get it working? (i get unreported exception error)

thanks.