有那位哥哥能仔细的解释一下这个编程的中心思想,最好能逐行解释,小弟弟跪求了!!,谢谢//设置菜单myMenu=newMenuBar();fileMenu=newMenu("File");helpMenu=newMenu("Help");myMenu.add(...
有那位哥哥能仔细的解释一下这个编程的中心思想,最好能逐行解释,小弟弟跪求了!!,谢谢
//设置菜单
myMenu=new MenuBar();
fileMenu=new Menu("File");
helpMenu=new Menu("Help");
myMenu.add(fileMenu);
myMenu.add(helpMenu);
fileMenuItem1=new MenuItem("Exit");
helpMenuItem1=new MenuItem("Version");
myMenu.add(fileMenu);
myMenu.add(helpMenu);
fileMenu.add(fileMenuItem1);
helpMenu.add(helpMenuItem1);
fileMenuItem1.addActionListener(new ActionListener1());
helpMenuItem1.addActionListener(new ActionListener1());
win1.setMenuBar(myMenu);
//设置对话框(help菜单)
dialog1=new MyDialog(win1,"关于简易ATM系统测试版",true);
dialog1.addWindowListener(this);
//用户名及密码
tx1=new TextField(10);
tx2=new TextField(10);
//设置各个Button
win1.add(myP,BorderLayout.CENTER);
myP.setLayout(new FlowLayout());
myP.add(new Label("username:"));
myP.add(tx1);
myP.add(new Label("password:"));
myP.add(tx2);
btn1=new Button("登陆");
btn2=new Button("清除");
btn1.addActionListener(new ActionListener1());
btn2.addActionListener(new ActionListener1());
btn3=new Button("账户余额");
btn3.setForeground(Color.black);
btn3.setBackground(Color.WHITE);
btn3.addActionListener(new ActionListener1());
btn4=new Button("我要取款");
btn4.setForeground(Color.black);
btn4.setBackground(Color.WHITE);
btn4.addActionListener(new ActionListener1());
btn5=new Button("修改密码");
btn5.setForeground(Color.black);
btn5.setBackground(Color.WHITE);
btn5.addActionListener(new ActionListener1());
btn6=new Button("退出系统");
btn6.setForeground(Color.black);
btn6.setBackground(Color.WHITE);
btn6.addActionListener(new ActionListener1());
myP.add(btn1);
myP.add(btn2);
win1.add(myP2,BorderLayout.EAST);
myP2.setLayout(new GridLayout(4,1));
myP2.add(btn3);
myP2.add(btn4);
myP2.add(btn5);
myP2.add(btn6);
logo=new Label("欢迎来到本系统!");
logo.setFont(new Font("Serif",Font.PLAIN,15));
win1.add(logo,BorderLayout.NORTH);
win1.setSize(600,400);
win1.setVisible(true);
win1.addWindowListener(this);
}
public static void main(String args[])
{
new JDBC();
//显示logo图片
Thread thread;
Logo lg=new Logo("LOGO.GIF");
thread=new Thread(lg);
thread.start();
}
展开