大学生课程设计------留言管理系统
系统流程图
运行效果
数据库表
3.4.2数据库E-R图
3.5运行结果与调试
登录界面
核心源码:
contentPanel.add(lblNewLabel); { { JButton okButton = new JButton("OK"); okButton.setVerticalAlignment(SwingConstants.TOP); contentPanel.add(okButton); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okAction(); } private void okAction() { dispose(); } }); okButton.setBounds(251 , 74, 71, 27); okButton.setActionCommand("OK"); getRootPane().setDefaultButton(okButton); } } }
注册
核心源码:
mainPanel.add(messageLabel); { { JButton cancelButton = new JButton("cancel"); cancelButton.setVerticalAlignment(SwingConstants.TOP); mainPanel.add(cancelButton); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cancelAction(); } }); cancelButton.setBounds(224 , 74, 98, 26); cancelButton.setActionCommand("OK"); getRootPane().setDefaultButton(cancelButton); } } okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okAction(); } }); okButton.setBounds(26, 74, 98, 26); mainPanel.add(okButton); okButton.setVerticalAlignment(SwingConstants.TOP); okButton.setActionCommand("OK"); } private void okAction() { this.dispose(); } private void cancelAction() { this.dispose(); AdminRegister register=(AdminRegister) PageSwitchUtils.getPage("register"); register.dispose(); AdminLogin adminLogin=(AdminLogin)PageSwitchUtils.getPage("login"); if(adminLogin!=null) { adminLogin.setVisible(true); }else { adminLogin=new AdminLogin(); adminLogin.setVisible(true); PageSwitchUtils.addPage("login", adminLogin); } return; }
游客登录
核心源码:
jMenuBar1.add(contentManageMenu); contentManageChileMenu = new javax.swing.JMenuItem(); contentManageMenu.add(contentManageChileMenu); contentManageChileMenu.setText("留言管理"); contentManageChileMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { CustomContent goodsTypeManageInterFrm=new CustomContent(); goodsTypeManageInterFrm.setVisible(true); table.add(goodsTypeManageInterFrm); } }); setJMenuBar(jMenuBar1); aboveMenu = new javax.swing.JMenu(); memberInfo = new javax.swing.JMenuItem(); aboveMenu.setText("关于"); memberInfo.setText("小组信息"); memberInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { table111ActionPerformed(evt); } }); aboveMenu.add(memberInfo); jMenuBar1.add(aboveMenu); JButton btnNewButton = new JButton("首页"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { index(); } }); jMenuBar1.add(btnNewButton); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(table) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(table) ); pack(); }// </editor-fold> protected void index() { CustomManage customManage= (CustomManage)PageSwitchUtils.getPage("customManage"); PageSwitchUtils.deletePage("customManage"); customManage.dispose(); AdminLogin adminLogin=new AdminLogin(); adminLogin.setVisible(true); PageSwitchUtils.addPage("login", adminLogin); } private void table111ActionPerformed(ActionEvent evt) { InterFrm interFrm=new InterFrm(); interFrm.setVisible(true); table.add(interFrm); }
管理员登录
核心源码:
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("留言管理系统主界面"); javax.swing.GroupLayout tableLayout = new javax.swing.GroupLayout(table); table.setLayout(tableLayout); tableLayout.setHorizontalGroup( tableLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 516, Short.MAX_VALUE) ); tableLayout.setVerticalGroup( tableLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 301, Short.MAX_VALUE) ); contentManageMenu.setText("留言信息管理"); contentManageMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jMenu1ActionPerformed(evt); } }); contentManage.setText("留言管理"); addConetntMenu.setText("留言添加"); addConetntMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AddContent goodsTypeAddInterFrm=new AddContent(); goodsTypeAddInterFrm.setVisible(true); table.add(goodsTypeAddInterFrm); } }); contentManage.add(addConetntMenu); contentManageChileMenu.setText("留言管理"); contentManageChileMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UserContentInfo goodsTypeManageInterFrm=new UserContentInfo(); goodsTypeManageInterFrm.setVisible(true); table.add(goodsTypeManageInterFrm); } }); contentManage.add(contentManageChileMenu); contentManageMenu.add(contentManage); exitMenu.setText("安全退出"); exitMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int result=JOptionPane.showConfirmDialog(null,"是否退出系统?"); if(result==0){ dispose(); } } }); contentManageMenu.add(exitMenu); jMenuBar1.add(contentManageMenu); setJMenuBar(jMenuBar1); userManageMenu = new JMenu("用户信息管理"); jMenuBar1.add(userManageMenu); userAddMenu = new JMenuItem("用户添加"); userAddMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { AddUser goodsTypeManageInterFrm=new AddUser(); goodsTypeManageInterFrm.setVisible(true); table.add(goodsTypeManageInterFrm); } }); userManageMenu.add(userAddMenu); userManagerMenu = new JMenuItem("用户管理"); userManagerMenu.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { UserInfo goodsTypeManageInterFrm=new UserInfo(); goodsTypeManageInterFrm.setVisible(true); table.add(goodsTypeManageInterFrm); } }); userManageMenu.add(userManagerMenu); aboveMenu = new javax.swing.JMenu(); memberInfo = new javax.swing.JMenuItem(); aboveMenu.setText("关于"); memberInfo.setText("小组信息"); memberInfo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { table111ActionPerformed(evt); } }); aboveMenu.add(memberInfo); jMenuBar1.add(aboveMenu); logoutButton = new JButton("系统注销"); logoutButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { logout(); } });
留言添加
核心源码:
setTitle("留言添加"); contentTitleLabel.setText("留言标题"); contentInfoLabel.setText("留言内容"); contentText.setColumns(20); contentText.setRows(5); contentValuejScrollPane.setViewportView(contentText); addButton.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N addButton.setText("添加"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton1ActionPerformed(evt); } }); revertButton.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N revertButton.setText("重置"); revertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton2ActionPerformed(evt); } });
留言管理
核心源码:
private void initComponents() { initVar(); setTitle("留言管理"); contentTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null,null,null}, {null, null, null,null,null}, {null, null, null,null,null}, {null, null, null,null,null}, {null, null, null,null,null}, {null, null, null,null,null} }, new String [] { "编号", "留言标题","作者", "留言内容","创建时间" } )); contentTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mousePressed(java.awt.event.MouseEvent evt) { jTable1MousePressed(evt); } }); tablePannel.setViewportView(contentTable); searchLabel.setFont(new java.awt.Font("宋体", 1, 14)); // NOI18N searchLabel.setForeground(new java.awt.Color(0, 204, 204)); searchLabel.setText("\u7559\u8A00\u6807\u9898\uFF1A"); searchButton.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N searchButton.setText("查询"); searchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { jButton1ActionPerformed(e); } }); operationPannel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "留言操作操作", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("宋体", 1, 14), new java.awt.Color(255, 0, 0))); // NOI18N idLabel.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N idLabel.setText("\u7559\u8A00id\uFF1A"); contentLabel.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N contentLabel.setText("\u7559\u8A00\u6807\u9898\uFF1A"); contentDescription.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N contentDescription.setText("\u7528\u6237\u7559\u8A00\u4FE1\u606F\uFF1A"); contentInfo.setColumns(20); contentInfo.setRows(5); descriptionPanel.setViewportView(contentInfo); modifyButton.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N modifyButton.setText("修改"); modifyButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); idText.setEditable(false); deleteButton.setFont(new java.awt.Font("宋体", 0, 14)); // NOI18N deleteButton.setText("删除"); deleteButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); javax.swing.GroupLayout gl_operationPannel = new javax.swing.GroupLayout(operationPannel); operationPannel.setLayout(gl_operationPannel);
添加用户
用户管理
用户登录
用户留言添加
用户留言管理