CalendarPad 开始=null;
MenuBar bar1;
MenuBar bar2;
Menu fileMenu;
MenuItem 录入;
MenuItem 加入;
public Main()
{
Frame win = new Frame();
录入=new MenuItem("进入日历记事本");
加入=new MenuItem("进入小游戏");
bar1=new MenuBar();
bar2=new MenuBar();
fileMenu=new Menu("菜单选项");
fileMenu.add(录入);
bar1.add(fileMenu);
win.setMenuBar(bar1);
fileMenu.add(加入);
bar2.add(fileMenu);
win.setMenuBar(bar2);
win.add(new Clock(),BorderLayout.CENTER);
win.setVisible(true);
win.setSize(246,280);
录入.addActionListener(this);
win.validate();
Calendar calendar=Calendar.getInstance();
a=calendar.get(Calendar.YEAR);
b=calendar.get(Calendar.MONTH)+1;
c=calendar.get(Calendar.DAY_OF_MONTH);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==录入)
{
开始=new CalendarPad (a,b,c );
开始.setVisible( true );
}
}
MenuBar bar1;
MenuBar bar2;
Menu fileMenu;
MenuItem 录入;
MenuItem 加入;
public Main()
{
Frame win = new Frame();
录入=new MenuItem("进入日历记事本");
加入=new MenuItem("进入小游戏");
bar1=new MenuBar();
bar2=new MenuBar();
fileMenu=new Menu("菜单选项");
fileMenu.add(录入);
bar1.add(fileMenu);
win.setMenuBar(bar1);
fileMenu.add(加入);
bar2.add(fileMenu);
win.setMenuBar(bar2);
win.add(new Clock(),BorderLayout.CENTER);
win.setVisible(true);
win.setSize(246,280);
录入.addActionListener(this);
win.validate();
Calendar calendar=Calendar.getInstance();
a=calendar.get(Calendar.YEAR);
b=calendar.get(Calendar.MONTH)+1;
c=calendar.get(Calendar.DAY_OF_MONTH);
addWindowListener(new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==录入)
{
开始=new CalendarPad (a,b,c );
开始.setVisible( true );
}
}