Gagan,
Below is some
test code for you, I have written an actionListener for capturing your exit click and then kick off the application. I know there is a better way to pull out of application but can not implement. Hope this will help.
//code start
import java.awt.AWTEvent.*;
import java.awt.*;
import java.awt.event.*;
public class exit implements ActionListener
{
public Frame f;
public void actionPerformed(ActionEvent ae)
{
System.out.println("Action performed.");
}
public exit()
{
f = new Frame();
MenuBar mb = new MenuBar();
Menu m = new Menu("Test");
m.add("Exit");
mb.add(m);
f.setMenuBar(mb);
f.setSize(200, 300);
f.setVisible(true);
m.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
System.exit(0);
}
}
);
}
public static void main (
String args[])
{
exit e = new exit();
}
}
// code End