java代码设计 java代码结构设计( 四 )


jp.add(button1);
jp.add(button2);
jp.add(button3);
jp.add(button4);
jp.add(button5);
jp.add(button6);
jp.add(button7);
c.add(jp);//将JPanel面板jp添加到顶级容器c中
setSize(600,500);
setTitle("*通 讯 录 管 理 系 统*");
setVisible(true);
setResizable(false);//窗体大小由程序员决定,用户不能自由改变大小
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
/**
*按键响应
*
**/
button1.addActionListener(new ActionListener(){//添加功能实现
public void actionPerformed(ActionEvent arg0){
Infro.addFunction();
}
});
button2.addActionListener(new ActionListener(){//删除功能实现
public void actionPerformed(ActionEvent arg0){
Infro.deleteFunction();
}
});
button3.addActionListener(new ActionListener(){//修改功能实现
public void actionPerformed(ActionEvent arg0){
Infro.reditFunction();
}
});
button4.addActionListener(new ActionListener(){//查询功能实现
public void actionPerformed(ActionEvent arg0){
try {
Infro.searchFunction();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
button5.addActionListener(new ActionListener(){//显示功能实现
public void actionPerformed(ActionEvent arg0){
Infro.showFunction();
}
});
button6.addActionListener(new ActionListener(){//保存功能实现
public void actionPerformed(ActionEvent arg0){
try {
Infro.writeFunction();
} catch (IOException e) {
e.printStackTrace();
}
}
});
button7.addActionListener(new ActionListener(){//读取功能实现
public void actionPerformed(ActionEvent arg0){
try {
Infro.readFunction();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Demo();
Infro a = new Infro("", "", "", "", "", "");
}
}
关于Java如何实现通讯录管理系统就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识 。如果觉得文章不错,可以把它分享出去让更多的人看到 。
java代码设计的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java代码结构设计、java代码设计的信息别忘了在本站进行查找喔 。

推荐阅读