基于javaweb+Swing+MySQL电子商城
开发工具:eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
box2.add(field); box3.add(label3); box3.add(field1); box4.add(label4); box4.add(field2); box5.add(button); box5.add(button1); base.add(box); base.add(Box.createVerticalStrut(40)); base.add(box1); base.add(Box.createVerticalStrut(40)); base.add(box2); base.add(Box.createVerticalStrut(40)); base.add(box3); base.add(Box.createVerticalStrut(40)); base.add(box4); base.add(Box.createVerticalStrut(40)); base.add(box5); base.add(Box.createVerticalStrut(40)); contenctPanel.add(base); add(contenctPanel); }
label2.setFont(new Font("微软雅黑",0,18));
label3.setText("请 输 入 要 删 除 用 户 的 序 号:");
label3.setFont(new Font("微软雅黑",0,18));
button.setText("确 定 删 除");
button.setFont(new Font("微软雅黑",0,18));
button.addActionListener(new Myaction());
button1.setText("返回管理员服务主界面");
button1.setFont(new Font("微软雅黑",1,18));
button1.setBorderPainted(false);
button1.setBackground(Color.WHITE);
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == button1) {
dispose();
AdminSelect select = new AdminSelect(adminname);
select.getName(adminname);
}
}
});
button7.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == button7) {
Option option = new Option();
dispose();
}
}
});
}
}
package com.shop.JFrame;
import com.shop.dao.*;
import com.shop.util.Util;
box10.add(field5); box11.add(button); box11.add(button1); base.add(box); base.add(Box.createVerticalStrut(10)); base.add(box0); base.add(Box.createVerticalStrut(10)); base.add(box1); base.add(Box.createVerticalStrut(10)); base.add(box2); base.add(Box.createVerticalStrut(10)); base.add(box3); base.add(Box.createVerticalStrut(30)); base.add(box4); base.add(Box.createVerticalStrut(30)); base.add(box5); base.add(Box.createVerticalStrut(30)); base.add(box6); base.add(Box.createVerticalStrut(30)); base.add(box7); base.add(Box.createVerticalStrut(30)); base.add(box8); base.add(Box.createVerticalStrut(30)); base.add(box9); base.add(Box.createVerticalStrut(30));
//private final JPasswordField password = new JPasswordField();//密码文本框 private final JLabel label = new JLabel(); private final JLabel label0 = new JLabel(); private final JLabel label1 = new JLabel(); private final JLabel label2 = new JLabel(); private final JLabel label3 = new JLabel(); private final JLabel label4 = new JLabel(); private final JButton button = new JButton(); private final JButton button1 = new JButton(); private final Box base = Box.createVerticalBox(); private final Box box = Box.createHorizontalBox(); private final Box box0 = Box.createHorizontalBox(); private final Box box1 = Box.createHorizontalBox(); private final Box box2 = Box.createHorizontalBox(); private final Box box3 = Box.createHorizontalBox(); private final Box box4 = Box.createHorizontalBox(); private final Box box5 = Box.createHorizontalBox(); private final Box box6 = Box.createHorizontalBox(); private final Box box7 = Box.createHorizontalBox(); private final Box box8 = Box.createHorizontalBox(); private JTextArea text= new JTextArea();
if(e.getSource() == button3) {
dispose();//销毁窗体
GoodsLook look = new GoodsLook();
}
}
});
button4.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == button4) {
dispose();//销毁窗体
DBgoodsDel del = new DBgoodsDel();
int num = Integer.parseInt(field.getText());
String name = goodsname.getgoodsName(num);
if(num < 1 || id.getgoodsID(num) != num || id.getgoodsID(num) == 0) {
JOptionPane.showMessageDialog(null,"输入的商品序号不存在!", "错误",JOptionPane.ERROR_MESSAGE);
field.setText("");
}else if(del.setDelgoods(num)) {
JOptionPane.showMessageDialog(null, name + " 商品删除成功", "删除成功",JOptionPane.DEFAULT_OPTION);
dispose();
AdminGoodsDel Del = new AdminGoodsDel(adminname);
}
}
}
}
package com.shop.JFrame;
import com.shop.dao.*;
import java.math.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class AdminGoodsInsert extends JFrame {
}
}
});
button2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource() == button2) {
if(e.getSource() == button) {
//获取文本框输入的信息
username = field.getText();
password = password1.getText();
card = field2.getText();
String str = field3.getText();
age= Integer.parseInt(str);
useremail = field4.getText();
address = field5.getText();
String option =username + " 用户恭喜您注册成功";
//判断用户名、密码、年龄、身份证、邮箱地址,正确无误之后插入数据库
if(userdecide.Decide(username) == false || dbusername.decideUsername(username)) {
JOptionPane.showMessageDialog(null,"用户名不能重复,由字母和数字组成,至少为6位!", "错误",JOptionPane.ERROR_MESSAGE);
field.setText("");
}else if(userdecide.Decide(password) == false) {
JOptionPane.showMessageDialog(null,"密码必须由字母和数字组成,至少为6位!", "错误",JOptionPane.ERROR_MESSAGE);
运行环境
Java≥6、MySQL≥5.5
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
技术框架
Java Swing GUI
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
管理员管理商品、用户购买商品等
eclipse运行:
idea运行:
前台用户:
后台管理员:



