/*
* Created by JFormDesigner on Thu May 14 18:04:12 CST 2020
*/
package FlowerStore.Forms;
import java.beans.*;
import javax.imageio.ImageIO;
import javax.swing.table.*;
import FlowerStore.Entity.Customer;
import FlowerStore.Entity.Flower;
import FlowerStore.Entity.Orders;
import FlowerStore.Entity.ShopList;
import FlowerStore.Factory.FactoryDAO;
import FlowerStore.Factory.FactoryService;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.UIManager;
/**
* @author Ruvik
*/
public class Customer_Home extends JFrame {
List<Flower> list=new ArrayList<>();//存储所有花的列表
DefaultTableModel tableModel=new DefaultTableModel();//查询表格的数据源
private String name;//顾客的名字
private Customer customer=new Customer();
private int CustomerID;//顾客的ID
private String head[]=new String[] {"名字", "价格","数量", "颜色", "有货商店"};//花的表头
private String ListHead[]=new String[] {"名字", "单价","数量", "总价"};//购物车的表头
private String OrderList[]=new String[] {"名字", "单价","数量", "总价","日期"};//订单的表头
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JTabbedPane tabbedPane1;
private JPanel Check;
private JScrollPane scrollPane1;
private JTable FlowerList;
private JLabel ChooseTitle;
private JLabel Namelabel;
private JLabel Pricelabel;
private JTextField price1;
private JTextField price2;
private JLabel label6;
private JLabel numlabel;
private JTextField num1;
private JTextField num2;
private JLabel label8;
private JLabel label18;
private JLabel label19;
private JComboBox comboBox_name;
private JComboBox comboBox_color;
private JComboBox comboBox_shop;
private JButton buttonchoose;
private JPanel Buy;
private JLabel picturelabel;
private JLabel label9;
private JLabel label10;
private JLabel label11;
private JLabel namelabel;
private JLabel colorlabel;
private JLabel Numlabel;
private JLabel label15;
private JTextField buy_numtext;
private JLabel label16;
private JLabel pricelabel;
private JButton AddToList;
private JButton buyNowButton;
private JComboBox Buy_comboBox;
private JPanel shopping_cart;
private JButton checkout;
private JScrollPane scrollPane2;
private JTable shoplist;
private JLabel tips;
private JPanel Orders;
private JScrollPane scrollPane3;
private JTable listorder;
private JLabel ordertips;
private JPanel Me;
private JLabel Title;
private JLabel username;
private JLabel sex;
private JLabel phone;
private JLabel sign;
private JTextField usernametext;
private JTextField sextext;
private JTextField phonetext;
private JTextField signtext;
private JLabel PasswordTitle;
private JLabel originalP;
private JLabel newP;
private JButton SaveInformation;
private JLabel UserId_Title;
private JLabel UserID;
private JPasswordField original_password;
private JPasswordField new_password;
private JButton SavePass;
private JLabel label2;
private JPopupMenu popupMenu1;
private JMenuItem menuItem_delete;
// JFormDesigner - End of variables declaration //GEN-END:variables
public Customer_Home(){
initComponents();
}
//判断字符串是否为纯数字
public static boolean isInteger(String str) {
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
return pattern.matcher(str).matches();
}
//region 加载数据
private void thisWindowOpened(WindowEvent e) {
// TODO add your code here
InitData();//个人信息及查询页面加载
InitShopList();//购物车预加载
InitOrdersJPanel();//订单预加载
}
//加载查询界面
private void InitData(){
//region 个人信息获取及自动填充
name=login.name;
customer=FactoryDAO.getICustomer().getCustomerbyName(name);
CustomerID=customer.getCustomer_id();
UserID.setText(Integer.toString(customer.getCustomer_id()));
usernametext.setText(customer.getCustomer_name());
sextext.setText(customer.getCustomer_sex());
phonetext.setText(customer.getCustomer_phone());
signtext.setText(customer.getCustomer_sign());
//endregion
//region 获取全部花的信息
tableModel=new DefaultTableModel(FactoryService.getiCustomerService().CheckAllFlowers(head),head){
//使不可编辑
public boolean isCellEditable(int row, int column)
{
return false;
}
};
FlowerList.setModel(tableModel);//填充Jtable
FlowerList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);//
//清空数据重新加载
comboBox_name.removeAllItems();
comboBox_color.removeAllItems();
comboBox_shop.removeAllItems();
//第一个为空值,默认不选以及可以实现多次选择
comboBox_name.addItem(null);
comboBox_color.addItem(null);
comboBox_shop.addItem(null);
//自动填充下拉菜单
list=FactoryDAO.getIFlowers().CheckAllFlowers();
//填充名字(名字不会出现重复)
for(Flower v:list){
comboBox_name.addItem(v.getFlower_name());
Buy_comboBox.addItem(v.getFlower_name());
}
//填充颜色
List<String> ColorList=FactoryDAO.getIFlowers().checkAllColors();
for(String v:ColorList){
comboBox_color.addItem(v);
}
//填充商店
List<Integer> ShopID=FactoryDAO.getIFlowers().checkAllShops();
for(Integer v:ShopID){
comboBox_shop.addItem(FactoryDAO.getIStore().CheckStoreByID(v).getStore_name());
}
//endregion
}
//加载购物车
private void InitShopList() {
DefaultTableModel tableModelShop=new DefaultTableModel();//表格的数据源
tableModelShop = new DefaultTableModel(FactoryService.getiCustomerService().CheckMyList(ListHead, CustomerID), ListHead) {
//使不可编辑
public boolean isCellEditable(int row, int column) {
return false;
}
};
if (FactoryService.getiCustomerService().CheckMyList(ListHead, CustomerID).length!=0) {
shoplist.setModel(tableModelShop);//填充Jtable
shoplist.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
shoplist.setVisible(true);
checkout.setText("结算");
tips.setText("右键购物车内容可以删除哦~");
} else {
shoplist.setVisible(false);
tips.setVisible(true);
tips.setText("购物车竟然是空的哦~ 再忙,也要记得买点什么犒劳自己~");
String s="买买买!";
checkout.setText(s);
}
}
//加载账单
private void InitOrdersJPanel(){
DefaultTableModel tableModelOrders=new DefaultTableModel();//表格的数据源
tableModelOrders = new DefaultTableModel(FactoryService.getiCustomerService().CheckMyOrder(OrderList,CustomerID), OrderList) {
//使不可编辑
public boolean isCellEditable(int row, int column) {
return false;
}
};
if(FactoryService.getiCustomerService().CheckMyOrder(OrderList,CustomerID).length!=0){
listorder.setModel(tableModelOrders);//填充Jtable
listorder.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
order
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目)专为大学期间课程设计和期末大作业开发的高分设计项目,可作为高分课程设计和期末大作业的参考,含有代码注释小白也可看的懂,有能力的小伙伴也可以在此基础上进行二开,项目代码完整下载即可运行。 Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库脚本(高分项目) Java期末大作业鲜花销售管理系统代码+数据库
资源推荐
资源详情
资源评论
收起资源包目录
Java期末大作业,鲜花销售管理系统代码+数据库脚本.zip (54个子文件)
Flowerstore-master
FlowerStore
Tools
DBUtil.java 1KB
Forms
Customer_Home.java 47KB
regist.jfd 3KB
login.java 7KB
Manager_Home.jfd 20KB
login.jfd 4KB
Manager_Home.java 41KB
regist.java 5KB
Customer_Home.jfd 23KB
img
flowers
郁金香.png 340KB
非洲菊.png 723KB
兰花.png 678KB
薰衣草.png 304KB
梅花.png 360KB
勿忘我.png 243KB
风信子.png 312KB
菊花.png 299KB
剑兰.png 195KB
月季.png 389KB
茉莉花.png 363KB
head.png 88KB
玫瑰.png 595KB
list.png 143KB
紫罗兰.png 189KB
满天星.png 618KB
百合花.png 600KB
Realize
TestDAO.java 8KB
DAO
IUser.java 2KB
IShopList.java 4KB
ICustomer.java 5KB
IFlowers.java 13KB
IOrders.java 3KB
IStore.java 6KB
Service
ICustomerService.java 8KB
IFlowerStoreService.java 6KB
Interface
DAO
StoreDAO.java 530B
CustomerDAO.java 730B
FlowerDAO.java 1KB
UserDAO.java 290B
OrdersDAO.java 420B
ShopListDAO.java 454B
Service
FlowerStoreService.java 2KB
CustomerService.java 1KB
Main.java 469B
Factory
FactoryDAO.java 766B
FactoryService.java 602B
Entity
ShopList.java 1KB
Flower.java 1KB
Orders.java 1KB
Store.java 926B
Customer.java 1KB
User.java 671B
database.sql 8KB
.gitignore 29B
共 54 条
- 1
资源评论
- 2401_823838672024-06-21怎么能有这么好的资源!只能用感激涕零来形容TAT...
王二空间
- 粉丝: 6796
- 资源: 2024
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功