实现前的准备,需要配置jdbc,导入jdbc驱动

jdbc驱动包下载地址:

正文开始

本项目模拟真实的超市管理模式,以管理员为面向对象,所要实现的功能是基本的增删改查,具体实现步骤如下:

管理员登录

进入欢迎界面

进入仓库管理界面

管理员进行增删改查

1,定义欢迎界面Welcome.java

本界面 主要针对按钮进行了部分优化并设置了面板的背景显示 用户通过点击“进入系统”按钮进入到“登录界面”

package com.fruit.main;

import java.util.prefs.BackingStoreException;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

public class Welcome extends JFrame{

JButton b;

ImageIcon image;

JLabel label;

public Welcome() {

// TODO Auto-generated constructor stub

this.setTitle("水果超市欢迎您!");

this.setBounds(500, 100, 700, 600);

this.setLayout(null);

image = new ImageIcon("back.jpg");

label = new JLabel(image);

label.setBounds(0, 0, 700, 500);

b = new JButton("进入系统");

b.setBounds(200, 470, 280, 30);

this.add(label);

this.add(b);

this.setVisible(true);

}

public static void main(String[] args) {

// TODO Auto-generated method stub

new Welcome();

}

}

2,登录界面

部分代码如下:

Login.java

package com.fruit.main;

import java.awt.Color;

import java.awt.Font;

import java.util.List;

import java.util.Properties;

import javax.swing.ButtonGroup;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPasswordField;

import javax.swing.JRadioButton;

import javax.swing.JTextField;

import com.fruit.po.User;

import com.fruit.utils.BaseDao;

public class Login extends JFrame {

JLabel l_username, l_password, l_per;

JTextField t_username;

JPasswordField t_password;

JRadioButton r_per;

JButton b_login, b_reg, b_reset, b_exit;

public Login() {

// TODO Auto-generated constructor stub

this.setTitle("登录");

this.setBounds(500, 100, 700, 600);

this.setLayout(null);

//界面设计

l_username = new JLabel("用户名:");

l_username.setBounds(190, 150, 60, 37);

l_username.setForeground(Color.RED);

t_username = new JTextField();

t_username.setBounds(250, 155, 180, 30);

t_username.setFont(new Font("宋体", Font.PLAIN, 20));

l_password = new JLabel("密 码:");

l_password.setBounds(190, 215, 60, 37);

l_password.setForeground(Color.blue);

t_password = new JPasswordField();

t_password.setBounds(250, 220, 180, 30);

t_password.setFont(new Font("宋体", Font.PLAIN, 20));

l_per = new JLabel("权 限:");

l_per.setBounds(190, 280, 130, 40);

l_per.setForeground(Color.green);

r_per = new JRadioButton("管理员");

r_per.setBounds(255, 290, 100, 20);

r_per.setSelected(true);

b_login = new JButton("登录");

b_login.setBounds(180, 350, 60, 30);

b_reg = new JButton("注册");

b_reg.setBounds(260, 350, 60, 30);

b_reset = new JButton("重置");

b_reset.setBounds(340, 350, 60, 30);

b_exit = new JButton("退出");

b_exit.setBounds(425, 350, 60, 30);

this.add(l_username);

this.add(l_password);

this.add(l_per);

this.add(t_username);

this.add(t_password);

this.add(r_per);

this.add(b_login);

this.add(b_reg);

this.add(b_reset);

this.add(b_exit);

this.setVisible(true);

}

public static void main(String[] args) {

// TODO Auto-generated method stub

//new Login();

new Welcome();

}

}

3,注册界面reg.java

package com.fruit.main;

import java.awt.Color;

import java.awt.Font;

import java.io.FileOutputStream;

import java.util.List;

import java.util.Properties;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JRadioButton;

import javax.swing.JTextField;

import com.fruit.po.User;

import com.fruit.utils.BaseDao;

import com.fruit.utils.PageUtil;

public class Reg extends JFrame{

JLabel l_username, l_password;

JTextField t_username,t_password;

JButton b_login,b_reg,b_reset;

public Reg() {

// TODO Auto-generated constructor stub

this.setTitle("注册");

this.setBounds(500, 100, 700, 600);

this.setLayout(null);

//界面设计

l_username = new JLabel("用户名:");

l_username.setBounds(190, 150, 60, 37);

l_username.setForeground(Color.RED);

t_username=new JTextField();

t_username.setBounds(250, 155,180, 30);

t_username.setFont(new Font("宋体",Font.PLAIN,20));

l_password = new JLabel("密 码:");

l_password.setBounds(190, 215, 60, 37);

l_password.setForeground(Color.blue);

t_password=new JTextField();

t_password.setBounds(250, 220,180, 30);

t_password.setFont(new Font("宋体",Font.PLAIN,20));

b_reg = new JButton("确定注册");

b_reg.setBounds(190, 350, 90, 30);

b_login = new JButton("返回登录");

b_login.setBounds(290, 350, 90, 30);

b_reset = new JButton("重置");

b_reset.setBounds(390, 350, 90, 30);

this.add(l_username);

this.add(l_password);

this.add(t_username);

this.add(t_password);

this.add(b_reg);

this.add(b_login);

this.add(b_reset);

this.setVisible(true);

}

public static void main(String[] args) {

// TODO Auto-generated method stub

//new Reg();

new Welcome();

}

}

4,商店界面Goods.java

package com.fruit.main;

import java.awt.Color;

import java.awt.Font;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextField;

import com.fruit.utils.BaseDao;

public class Goods extends JFrame{

JLabel listTitle,l_id,l_name,l_price,l_unit;

JTable table;

JScrollPane tablePane;//滚动

JTextField j_add_id,j_add_name,j_add_price,j_add_unit

,j_up_id,j_up_name,j_up_price,j_up_unit,j_de_id;

JButton b_add,b_up,b_de,b_exit;

public Goods() {

// TODO Auto-generated constructor stub

this.setTitle("超市货物管理");

this.setBounds(500, 100, 700, 600);

this.getContentPane().setBackground(Color.cyan);

this.setLayout(null);

//标题

listTitle = new JLabel("水果列表");

listTitle.setBounds(280, 15, 100, 20);

listTitle.setFont(new Font("黑体",Font.PLAIN,20));

this.add(listTitle);

//退出登录

b_exit = new JButton("退出登录");

b_exit.setBounds(520, 15, 100, 20);

b_exit.setFont(new Font("宋体",Font.PLAIN,16));

add(b_exit);

//表格

table = new JTable();

tablePane = new JScrollPane();

table.getTableHeader().setReorderingAllowed(false);//列不可移动

table.getTableHeader().setResizingAllowed(false);//不可拉动表格

table.setEnabled(false);//不可更改数据

tablePane.setBounds(30,50,630,270);

tablePane.setViewportView(table);

this.add(tablePane);

//标签

l_id = new JLabel("水果编号");

l_name = new JLabel("水果名称");

l_price = new JLabel("水果单价");

l_unit = new JLabel("计价单位");

l_id.setBounds(30, 330, 100, 30);

l_id.setFont(new Font("宋体",Font.PLAIN,16));

l_name.setBounds(150, 330, 100, 30);

l_name.setFont(new Font("宋体",Font.PLAIN,16));

l_price.setBounds(280, 330, 100, 30);

l_price.setFont(new Font("宋体",Font.PLAIN,16));

l_unit.setBounds(410, 330, 100, 30);

l_unit.setFont(new Font("宋体",Font.PLAIN,16));

this.add(l_id);

this.add(l_name);

this.add(l_price);

this.add(l_unit);

//增加

j_add_id = new JTextField();

j_add_name = new JTextField();

j_add_price = new JTextField();

j_add_unit = new JTextField();

j_add_id.setBounds(30, 360, 80, 30);

j_add_name.setBounds(150, 360, 80, 30);

j_add_price.setBounds(280, 360, 80, 30);

j_add_unit.setBounds(410, 360, 80, 30);

this.add(j_add_id);

this.add(j_add_name);

this.add(j_add_price);

this.add(j_add_unit);

b_add = new JButton("提交");

b_add.setBounds(540, 360, 80, 30);

b_add.setFont(new Font("宋体",Font.PLAIN,16));

this.add(b_add);

//修改

j_up_id = new JTextField();

j_up_name = new JTextField();

j_up_price = new JTextField();

j_up_unit = new JTextField();

j_up_id.setBounds(30, 410, 80, 30);

j_up_name.setBounds(150, 410, 80, 30);

j_up_price.setBounds(280, 410, 80, 30);

j_up_unit.setBounds(410, 410, 80, 30);

this.add(j_up_id);

this.add(j_up_name);

this.add(j_up_price);

this.add(j_up_unit);

b_up = new JButton("改动");

b_up.setBounds(540, 410, 80, 36);

b_up.setFont(new Font("宋体",Font.PLAIN,16));

this.add(b_up);

//删除

j_de_id = new JTextField();

j_de_id.setBounds(30, 460, 80, 36);//510

this.add(j_de_id);

b_de = new JButton("删除");

b_de.setBounds(540, 460, 80, 36);//510

b_de.setFont(new Font("宋体",Font.PLAIN,16));

this.add(b_de);

this.setVisible(true);

}

public static void main(String[] args) {

// TODO Auto-generated method stub

new Goods();

//new Welcome();

}

}

java水果仓库管理系统_java水果商城管理系统(界面框架代码)相关推荐

  1. 课程设计——基于JAVA的仓库管理系统

    要求如下: 系统总需求分析: "仓库管理系统"包括七大功能,一:进仓管理:通过管理员输入货物进仓的时间,系统自动分配进仓编号:二:出仓管理:通过管理员输入货物出仓的时间,实现出仓: ...

  2. 化工行业RFID仓库管理系统-RFID智慧仓库管理系统-杭州东识科技

    市场竞争日益激烈,提高生产率.降低运营成本,对于企业来说至关重要.目前,仓储管理系统通常使用条码标签或是人工仓储管理单据等方式支持自有的仓储管理.但是条码的易复制,不防污,不防潮,操作繁琐等特点,和人 ...

  3. java成绩管理系统设计背景_java学生成绩管理系统界面设计

    关于学生成绩管理系统的界面设计:代码如下 数据库表设计 DROP TABLE IF EXISTS `student`; CREATE TABLE `student` ( `username` varc ...

  4. java入门——仓库管理系统

    文章目录 写在前面 需求说明 阶段1需求 阶段2需求 阶段3需求 阶段4需求 阶段5需求 阶段6需求 实现 数据库设计 接口编写 jmeter测试 使用@cacheable注解 改为纯Redis 改为 ...

  5. ssm+java计算机毕业设计基于java的仓库管理系统9rew6(程序+lw+源码+远程部署)

    项目运行 项目含有源码(见文末).文档.程序.数据库.配套开发软件.软件安装教程 环境配置: Jdk1.8 + Tomcat7.0 + Mysql + HBuilderX(Webstorm也行)+ E ...

  6. 【原创】JavaWeb仓库管理系统(Web仓库管理系统毕业设计)

    使用jsp+servlet.通过3种角色使用.包括了仓库物资的入库.出库等多个不同的模块.对于登录的时候,设置密码的规范,供应商和仓库管理员进行仓库物资的出入库操作. 项目类型:JavaWeb源码 用 ...

  7. python wms系统源码_jeewms仓库管理系统 v2.4.0

    jeewms是一个基于JAVA的仓库管理系统,是由灵鹿谷科技主导的开源项目,WMS在经过多家公司上线运行后,为了降低物流仓储企业的信息化成本,决定全面开源此产品.针对有特殊信息化需求的企业,提供高性价 ...

  8. 芯宇宙通用仓库管理系统V1.0说明书

    芯宇宙通用仓库管理系统V1.0 <单机版> 使用说明书 作者:池盛龙 QQ:1372823826 日期:2022-9-9 官网:驰盛隆.top 目录 芯宇宙通用仓库管理系统V1.0 概述 ...

  9. 仓库管理系统GreaterWMS的安装

    本文是应网友 ubuntu 和 Nathan 要求写的:因为看起来 Nathan 比较着急,就突击了一下,因为时间仓促,错误在所难免,敬请谅解~ 什么是 GreaterWMS ? GreaterWMS ...

  10. java毕业设计东方水处理厂原材料仓库管理系统Mybatis+系统+数据库+调试部署

    java毕业设计东方水处理厂原材料仓库管理系统Mybatis+系统+数据库+调试部署 java毕业设计东方水处理厂原材料仓库管理系统Mybatis+系统+数据库+调试部署 本源码技术栈: 项目架构:B ...

最新文章

  1. listdir完整路径
  2. 数学建模国赛 常考赛题类型(模拟退火算法、粒子群算法、遗传算法)
  3. 如何在同一地方组建多个 ZigBee 网络
  4. 面试官:背了几道面试题就敢说熟悉Java源码?我们不招连源码都不会看的人|原力计划...
  5. php图像销毁_php对图像的各种处理函数代码小结
  6. 线程池ThreadPoolExecutor使用
  7. Mac电脑上设置应用程序开机启动详细教程!速来get一下
  8. c++多边形扫描线填充算法_一文读懂扫描线算法
  9. Winform UI界面设计例程——ListView控件
  10. 51单片机的定时器/计数器
  11. Linux——Linux系统编程之基于TFTP实现服务器与开发板间的文件传输实战总结
  12. 《Designing and Training of A Dual CNN for Image Denoising》阅读笔记
  13. NC65 查询信用余额——客户信用联查、销售订单信用联查等
  14. win10删除第三方增加的“设备和驱动器”
  15. SpringBoot+Vue博客项目中遇到的坑
  16. 如何在线对图片进行压缩?
  17. 计算机二级c++考试
  18. 禁用计算机服务,win7系统禁用不需要服务的操作方法
  19. WPF编程,使用系统自带的Wingdings字体。
  20. 刚从阿里、头条面试回来,熬夜整理华为最新Java笔试题,进阶学习

热门文章

  1. mac版本markdown编辑器工具:Typora 下载
  2. 微信小程序的布局css样式
  3. navicat建mysql数据库密码_Navicat修改MySQL数据库密码的多种方法
  4. 演化博弈matlab代码,Matlab演化博弈仿真
  5. 开发交接文档_为开发人员创造更好的设计交接体验
  6. Ubuntu20.04 搜狗输入法安装
  7. Bridge的VLAN接口模式
  8. oom killer lmkd killer
  9. Word里的数学符号在哪里
  10. MATLAB信号与系统实验(一)