Computer Science Canada

Menu items.

Author:  magicman [ Tue Oct 26, 2004 12:30 pm ]
Post subject:  Menu items.

I'm making a program and i'm having some trouble. I need to make a file thing. u know that thing that u have on the top of im or ff or what ever u use. The thing that you go to, to open a new file or something.
Here is my code.
code:

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


public class Keystrokes
{
    static Console c;
    public Keystrokes ()
    {
        JFrame frame = new JFrame ("New Window");
        Container content = frame.getContentPane ();
        content.setLayout (new FlowLayout ());
        frame.setSize (640, 950);
        // c = new Console ();
        //c.println ("HELLO");
        JMenuBar jmb = new JMenuBar ();
        JMenu fileMenu = new JMenu ("File");
        JMenuItem quitItem = new JMenuItem ("Quit");
        jmb.add (fileMenu);
        fileMenu.add (quitItem);
        frame.setJMenuBar (jmb);
       
        quitItem.addActionListener (new ActionListener ()
        {
            public void actionPerformed (ActionEvent ae)
            {
                System.exit (0);
            }
        }
        );
        fileMenu.setMnemonic (KeyEvent.VK_F);
        quitItem.setMnemonic (KeyEvent.VK_Q);
        frame.setVisible (true);
    }
    public static void main (String [] args)
    {
        new Keystrokes ();
    }
}


Also i need something that also goes with
code:

  fileMenu.add (quitItem);


thanx Laughing


: