图4-1 用户信息管理
4.2.2 基本信息管理模块
本模块负责会员、羽毛球场馆信息和场馆预约的信息管理,如图4-2所示,将公司信息分为会员和羽毛球场馆两种类型的数据信息都放在数据表中,该数据表存储有会员信息与羽毛球场馆的基本信息,对表中内容进行添加、删除、修改就可以完成对会员以及羽毛球场馆资料的实时更新,保证数据的准确性。
羽毛球馆信息的管理包括羽毛球场馆相关的价格、大小(容纳人数)、参考图片等的修改、添加、删除等功能。本模块是整个羽毛球馆管理系统功能实现的基础,数据库内没有准确的数据源,那么其它功能就没有实现的价值了,而修改、添加可以达到数据及时更新的目的。
图4-2 羽毛球馆信息管理图
4.2.3 其他功能
该模块的功能是主要为了增强系统首页面的效果,更加人性化。通过网站公告功能,让进入羽毛球馆页面的每一位顾客及时了解到管理员发布的关于羽毛球馆或羽毛球运动的一些信息。如图4-3所示:
package ymq;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
public class index extends JFrame{
private CardLayout cl;
private Welcome welcome;
private NewVIP newVIP ;
private Newfee newfee;
private DeleteVIP deleteVIP;
private ChangeVIP changeVIP;
private NewOrder newOrder;
private ExistOrder existOrder;
private SelectVIP selectVIP;
private ChangeG changeg;
private DesignVal designVal;
//创建树的各个节点
private DefaultMutableTreeNode dtmtRoot=new DefaultMutableTreeNode(new MyNode("操作选项","0"));
private DefaultMutableTreeNode dtmt1=new DefaultMutableTreeNode(new MyNode("参数设置","1"));
private DefaultMutableTreeNode dtmt2=new DefaultMutableTreeNode(new MyNode("会员管理","2"));
private DefaultMutableTreeNode dtmt3=new DefaultMutableTreeNode(new MyNode("预约管理","3"));
private DefaultMutableTreeNode dtmt4=new DefaultMutableTreeNode(new MyNode("费用管理","4"));
private DefaultMutableTreeNode dtmt11=new DefaultMutableTreeNode(new MyNode("场地定义","11"));
private DefaultMutableTreeNode dtmt12=new DefaultMutableTreeNode(new MyNode("计价定义","12"));
private DefaultMutableTreeNode dtmt21=new DefaultMutableTreeNode(new MyNode("新增会员","21"));
private DefaultMutableTreeNode dtmt23=new DefaultMutableTreeNode(new MyNode("会员变更","23"));
private DefaultMutableTreeNode dtmt22=new DefaultMutableTreeNode(new MyNode("注销会员","22"));
private DefaultMutableTreeNode dtmt24=new DefaultMutableTreeNode(new MyNode("查询会员","24"));
private DefaultMutableTreeNode dtmt31=new DefaultMutableTreeNode(new MyNode("新增预约","31"));
private DefaultMutableTreeNode dtmt32=new DefaultMutableTreeNode(new MyNode("已有预约","32"));
private DefaultMutableTreeNode dtmt41=new DefaultMutableTreeNode(new MyNode("收取费用","41"));
//创建根节点
private DefaultTreeModel dtmt=new DefaultTreeModel(dtmtRoot);
//创建树状列表控件
private JTree jtree=new JTree(dtmt);
private JScrollPane jspj=new JScrollPane(jtree);
//创建存放个功能模块面板
private JPanel jpy=new JPanel();
private JSplitPane jsp1=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,jspj,jpy);
public index() {
this.initialTree();
this.initialPane();
this.initialjp1();
this.addListener();
this.initialFrame();
}
private void initialFrame() {
this.add(jsp1);
jsp1.setDividerLocation(200);
jsp1.setDividerSize(4);
this.setTitle("羽毛球馆信息管理系统");
Image img=new ImageIcon(".\\res\\ico.gif").getImage();
this.setIconImage(img);
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
int centerX=screenSize.width/2;
int centerY=screenSize.height/2;
int w=800;
int h=500;
this.setBounds(centerX-w/2,centerY-h/2,w,h);
this.setVisible(true);
//this.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
private void initialjp1() {
jpy.setLayout( new CardLayout());
cl=(CardLayout)jpy.getLayout();
jpy.add(welcome,"welcome");
jpy.add(newfee,"newfee");
jpy.add(newVIP,"newVIP");
jpy.add(deleteVIP,"deleteVIP");
jpy.add(changeVIP,"changeVIP");
jpy.add(newOrder,"newOrder");
jpy.add(existOrder,"existOrder");
jpy.add(selectVIP,"selectVIP");
jpy.add(changeg,"changeg");
jpy.add(designVal,"designVal");
}
private void initialPane() {
welcome=new Welcome("欢迎");
newVIP=new NewVIP();
newfee=new Newfee();
deleteVIP=new DeleteVIP();
changeVIP=new ChangeVIP();
newOrder=new NewOrder();
existOrder=new ExistOrder();
selectVIP=new SelectVIP();
changeg=new ChangeG();
designVal=new DesignVal();
}
private void initialTree() {
dtmtRoot.add(dtmt1);
dtmtRoot.add(dtmt2);
dtmtRoot.add(dtmt3);
dtmtRoot.add(dtmt4);
dtmt1.add(dtmt11);
dtmt1.add(dtmt12);
dtmt2.add(dtmt21);
dtmt2.add(dtmt22);
dtmt2.add(dtmt23);
dtmt2.add(dtmt24);
dtmt3.add(dtmt31);
dtmt3.add(dtmt32);
dtmt4.add(dtmt41);
jtree.setToggleClickCount(1);
}
private void addListener() {
jtree.addMouseListener(
new MouseAdapter() {
public void mouseClicked(MouseEvent e){
DefaultMutableTreeNode dmtntemp=(DefaultMutableTreeNode)jtree.getLastSelectedPathComponent();
MyNode mn=(MyNode)dmtntemp.getUserObject();
String id=mn.getId();
//System.out.println(id);
if(id.equals("21")){
cl.show(jpy,"newVIP");
}
else if(id.equals("11")){
cl.show(jpy,"changeg");
}
else if(id.equals("12")){
cl.show(jpy,"designVal");
}
else if(id.equals("23")){
cl.show(jpy, "changeVIP");
}
else if(id.equals("22")){
cl.show(jpy, "deleteVIP");
}
else if(id.equals("31")){
cl.show(jpy, "newOrder");
}
else if(id.equals("24")){
cl.show(jpy, "selectVIP");
}
else if(id.equals("32")){
cl.show(jpy, "existOrder");
}
else if(id.equals("41")){
cl.show(jpy,"newfee");
}
}
}
);
}
public static void main(String[] args) {
index wel=new index();
}
}
class MyNode
{
private String values;
private String id;
public MyNode(String values,String id)
{
this.values=values;
this.id=id;
}
public String toString()
{
return this.values;
}
public String getId()
{
return this.id;
}
}