JMenu jMenuFile = new JMenu("File"); jMenuFile.setMnemonic('F'); JMenuItem exit = new JMenuItem("Exit"); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae_) {
JMenu jMenuFile = new JMenu( "File" ); jMenuFile.setMnemonic( 'F' );  JMenuItem exit = new JMenuItem( "Exit" ); exit.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent ae_ ) { Thread t = new Thread( new Runnable() { public void run() { done(); } } );
        private void addMenuBar() {            JMenuBar menubar = new JMenuBar();            JMenu jMenuFile = new JMenu("File");            jMenuFile.setMnemonic('F');            JMenuItem exit = new JMenuItem("Exit");            exit.addActionListener(new ActionListener() {                public void actionPerformed(ActionEvent ae_) {                    done();                }            });            JMenuItem eval = new JMenuItem("Evaluate");            eval.addActionListener(new ActionListener() {                public void actionPerformed(ActionEvent ae_) {                    evaluateText();                    repaint();                }            });            menubar.add(jMenuFile);            jMenuFile.add(eval);            jMenuFile.add(exit);            setJMenuBar(menubar);        }