Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Menu items.
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
magicman




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: