java商品管理系统.docx

上传人:b****8 文档编号:13064513 上传时间:2023-06-10 格式:DOCX 页数:27 大小:20.48KB
下载 相关 举报
java商品管理系统.docx_第1页
第1页 / 共27页
java商品管理系统.docx_第2页
第2页 / 共27页
java商品管理系统.docx_第3页
第3页 / 共27页
java商品管理系统.docx_第4页
第4页 / 共27页
java商品管理系统.docx_第5页
第5页 / 共27页
java商品管理系统.docx_第6页
第6页 / 共27页
java商品管理系统.docx_第7页
第7页 / 共27页
java商品管理系统.docx_第8页
第8页 / 共27页
java商品管理系统.docx_第9页
第9页 / 共27页
java商品管理系统.docx_第10页
第10页 / 共27页
java商品管理系统.docx_第11页
第11页 / 共27页
java商品管理系统.docx_第12页
第12页 / 共27页
java商品管理系统.docx_第13页
第13页 / 共27页
java商品管理系统.docx_第14页
第14页 / 共27页
java商品管理系统.docx_第15页
第15页 / 共27页
java商品管理系统.docx_第16页
第16页 / 共27页
java商品管理系统.docx_第17页
第17页 / 共27页
java商品管理系统.docx_第18页
第18页 / 共27页
java商品管理系统.docx_第19页
第19页 / 共27页
java商品管理系统.docx_第20页
第20页 / 共27页
亲,该文档总共27页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

java商品管理系统.docx

《java商品管理系统.docx》由会员分享,可在线阅读,更多相关《java商品管理系统.docx(27页珍藏版)》请在冰点文库上搜索。

java商品管理系统.docx

java商品管理系统

//代表各的主页面

packagecom.gui;

importjava.awt.*;

importjavax.swing.*;

importjava.awt.event.*;

importjava.io.*;

importjava.nio.channels.ClosedSelectorException;

importjava.sql.*;

importjavax.swing.JFileChooser;

importjavax.swing.plaf.ScrollBarUI;

importjavax.swing.table.DefaultTableColumnModel;

importjavax.swing.table.DefaultTableModel;

importcom.DateSystem.Good_data;

importcom.DateSystem.Goods;

importcom.DateSystem.Userdate;

importjava.util.List;

publicclassMainextendsJFrameimplementsActionListener,AdjustmentListener{

/**

*@paramargs

*/

//主窗体组件

MenuBarmenuBar;

Menumenu_xitong,menu_guanli,menu_gongju,menu_Help;

MenuItemitem_up_password,item_reLanding,item_exit;

MenuItemitem_input,item_find,item_delete;

MenuItemitem_jisuanqi,item_jishiben,item_beijing;

MenuItemitem_LookHelp,item_About;

//录入界面要用的组件

JPaneljp_btn,jp_main,jp_table,jp_text;

JLabellbl_id,lbl_name,lbl_address,lbl_in_price,lbl_out_price,lbl_kucun,lbl_jinhuo,lbl_chuhuo;

TextFieldtext_id,text_name,text_address,text_in_price,text_out_price,text_kucun,text_jinhuo,text_chuhuo;

JButtonsubmit,reset,delete;

JScrollPanejsp;

JTabletable;

DefaultTableModelmodel;

CardLayoutc=newCardLayout();

JPanelcard;

//查找页面要用的组件

JPaneljp1,jp2,jp3;

JPaneljp2_main;

JButtonfind_id,find_name,find_delete,find_all;

JTextFieldtext_find;

JScrollPanejsp_find;

JTabletable_find;

DefaultTableModelmodel_find;

//背景更改要用的组件

intr=255,g=255,b=255;

TextFieldtfr,tfg,tfb;

Scrollbarsbr,sbg,sbb;

Paneldisplay;

JPaneljp3_main;

publicMain(){

super("主窗口");

menuBar=newMenuBar();

menu_gongju=newMenu("工具");

menu_guanli=newMenu("管理");

menu_Help=newMenu("帮助");

menu_xitong=newMenu("系统");

item_About=newMenuItem("关于");

item_beijing=newMenuItem("背景设置");

item_LookHelp=newMenuItem("查看帮助");

item_up_password=newMenuItem("修改密码");

item_reLanding=newMenuItem("重新登录");

item_exit=newMenuItem("退出系统");

item_jishiben=newMenuItem("记事本");

item_jisuanqi=newMenuItem("计算器");

item_find=newMenuItem("查找");

item_input=newMenuItem("录入");

item_delete=newMenuItem("删除");

//注册监听

item_About.addActionListener(this);

item_beijing.addActionListener(this);

item_LookHelp.addActionListener(this);

item_up_password.addActionListener(this);

item_reLanding.addActionListener(this);

item_exit.addActionListener(this);

item_jishiben.addActionListener(this);

item_jisuanqi.addActionListener(this);

item_find.addActionListener(this);

item_input.addActionListener(this);

item_delete.addActionListener(this);

menu_xitong.add(item_up_password);

menu_xitong.add(item_reLanding);

menu_xitong.add(item_exit);

menu_guanli.add(item_input);

menu_guanli.add(item_find);

//menu_guanli.add(item_delete);

menu_gongju.add(item_jisuanqi);

menu_gongju.add(item_jishiben);

menu_gongju.add(item_beijing);

menu_Help.add(item_About);

menu_Help.add(item_LookHelp);

menuBar.add(menu_xitong);

menuBar.add(menu_guanli);

menuBar.add(menu_gongju);

menuBar.add(menu_Help);

setMenuBar(menuBar);

setResizable(false);

initComponents();//调用方法初始化界面

Find();

change_color();

//查找功能的布局以及组建

//this.setLayout(newCardLayout());

card=newJPanel();

card.setLayout(c);

card.add("1",jp_main);

card.add("2",jp2_main);

card.add("3",jp3_main);

//this.getContentPane().add("Center",jp_main);

this.add(card);

this.setSize(1000,500);

this.setLocationRelativeTo(null);

this.setVisible(true);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

//录入界面初始化

privatevoidinitComponents(){//构造面板

System.out.println("pass");

lbl_id=newJLabel("商品编号",JLabel.CENTER);

lbl_name=newJLabel("商品名称",JLabel.CENTER);

lbl_address=newJLabel("商品产地",JLabel.CENTER);

lbl_in_price=newJLabel("进价",JLabel.CENTER);

lbl_out_price=newJLabel("售价",JLabel.CENTER);

lbl_jinhuo=newJLabel("进货量",JLabel.CENTER);

lbl_chuhuo=newJLabel("销售量",JLabel.CENTER);

lbl_kucun=newJLabel("库存量",JLabel.CENTER);

text_id=newTextField();

text_name=newTextField();

text_address=newTextField();

text_in_price=newTextField();

text_out_price=newTextField();

text_jinhuo=newTextField();

text_chuhuo=newTextField();

text_kucun=newTextField();

jp_table=newJPanel(newBorderLayout());

jp_text=newJPanel(newGridLayout(2,8));

jp_text.add(lbl_id);

jp_text.add(lbl_name);

jp_text.add(lbl_address);

jp_text.add(lbl_in_price);

jp_text.add(lbl_out_price);

jp_text.add(lbl_jinhuo);

jp_text.add(lbl_chuhuo);

jp_text.add(lbl_kucun);

jp_text.add(text_id);

jp_text.add(text_name);

jp_text.add(text_address);

jp_text.add(text_in_price);

jp_text.add(text_out_price);

jp_text.add(text_jinhuo);

jp_text.add(text_chuhuo);

jp_text.add(text_kucun);

model=newDefaultTableModel(newObject[][]{

},newString[]{"商品编号","商品名称","商品产地","进价","售价","库存量","进货量","出货量"});

table=newJTable(model);

jsp=newJScrollPane(table);

submit=newJButton("录入商品");

reset=newJButton("重置信息");

delete=newJButton("删除所选商品");

submit.addActionListener(this);

reset.addActionListener(this);

delete.addActionListener(this);

jp_btn=newJPanel(newGridLayout(1,3));

jp_btn.add(submit);

jp_btn.add(delete);

jp_btn.add(reset);

jp_table.add("Center",jp_text);

jp_table.add("South",jp_btn);

jp_main=newJPanel(newBorderLayout(10,10));

jp_main.add("Center",jsp);

jp_main.add("North",jp_table);

System.out.println("pass");

}

//查找面板初始化面板

privatevoidFind(){

jp1=newJPanel(newGridLayout(1,1));

jp2=newJPanel(newGridLayout(1,4));

jp3=newJPanel(newBorderLayout());

find_id=newJButton("根据商品编号查询");

find_name=newJButton("根据商品名称查询");

find_all=newJButton("查询所有信息");

find_delete=newJButton("删除所选信息");

text_find=newJTextField();

jsp_find=newJScrollPane();

table_find=newJTable();

model_find=newDefaultTableModel();

model_find=newDefaultTableModel(newObject[][]{

},newString[]{"商品编号","商品名称","商品产地","进价","售价","库存量","进货量","出货量"});

table_find=newJTable(model_find);

jsp_find=newJScrollPane(table_find);

find_id.addActionListener(this);

find_name.addActionListener(this);

find_all.addActionListener(this);

find_delete.addActionListener(this);

jp1.add(text_find);

jp2.add(find_id);

jp2.add(find_name);

jp2.add(find_all);

jp2.add(find_delete);

jp3.add("North",jp1);

jp3.add("Center",jp2);

jp2_main=newJPanel(newBorderLayout(10,10));

jp2_main.add("Center",jsp_find);

jp2_main.add("North",jp3);

}

//背景更改

privatevoidchange_color(){

jp3_main=newJPanel();

display=newPanel();

display.setBackground(Color.WHITE);

Panelpcolor=newPanel();

pcolor.setLayout(newBorderLayout());

Panelpw=newPanel();

pw.setLayout(newGridLayout(3,2,0,0));

jp3_main.setLayout(newBorderLayout());

tfr=newTextField("255");

tfg=newTextField("255");

tfb=newTextField("255");

tfr.setEditable(false);

tfg.setEditable(false);

tfb.setEditable(false);

sbr=newScrollbar(Scrollbar.HORIZONTAL,255,0,0,255);

sbg=newScrollbar(Scrollbar.HORIZONTAL,255,0,0,255);

sbb=newScrollbar(Scrollbar.HORIZONTAL,255,0,0,255);

sbr.setName("SBR");

sbg.setName("SBG");

sbb.setName("SBB");

sbr.setBackground(Color.red);

sbg.setBackground(Color.green);

sbb.setBackground(Color.blue);

sbr.addAdjustmentListener(this);

sbg.addAdjustmentListener(this);

sbb.addAdjustmentListener(this);

pw.add(newLabel("红色"));

pw.add(tfr);

pw.add(newLabel("绿色"));

pw.add(tfg);

pw.add(newLabel("蓝色"));

pw.add(tfb);

Panelpc=newPanel();

pc.setLayout(newGridLayout(3,1,0,0));

pc.add(sbr);

pc.add(sbg);

pc.add(sbb);

pcolor.add(pw,BorderLayout.WEST);

pcolor.add(pc,BorderLayout.CENTER);

jp3_main.add(display,BorderLayout.CENTER);

jp3_main.add(pcolor,BorderLayout.SOUTH);

}

//查看帮助文档,调用本地的程序,查看帮助文档

publicvoiduseCMDCommand()throwsIOException{

Runtime.getRuntime().exec(newString[]{"cmd.exe","/c","..\\BaoDing_Shoop\\保定商场商品管理系统项目帮助.doc"});

}

//主函数

publicstaticvoidmain(String[]args){

//TODOAuto-generatedmethodstub

java.awt.EventQueue.invokeLater(newRunnable(){

publicvoidrun(){

newMain().setVisible(true);

}

});

}

//监听方法

publicvoidactionPerformed(ActionEvente){

//得到事件源

StringbtString=e.getActionCommand();

//录入功能

if(btString.equals("录入商品")){//追加到最后一行

if(!

text_id.getText().equals("")&&!

text_name.getText().equals("")&&!

text_address.getText().equals("")&&!

text_in_price.getText().equals("")&&!

text_out_price.getText().equals("")&&!

text_jinhuo.getText().equals("")&&!

text_chuhuo.getText().equals("")&&!

text_kucun.getText().equals("")){

//获取文本框信息

intidString=Integer.parseInt(text_id.getText());

Stringids=text_id.getText();

StringnameString=text_name.getText();

StringaddresString=text_address.getText();

doublein_priceString=Double.parseDouble(text_in_price.getText());

doubleout_priceString=Double.parseDouble(text_out_price.getText());

intjinhuoString=Integer.parseInt(text_jinhuo.getText());

intchuhuoString=Integer.parseInt(text_chuhuo.getText());

intkucun=Integer.parseInt(text_kucun.getText());

if(in_priceString<=0){

JOptionPane.showMessageDialog(this,"亲~,进价要大于零哦!

");

}else{

if(in_priceString>=out_priceString){

JOptionPane.showMessageDialog(this,"亲~,要有盈利的,销售价格要大于进价!

");

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 医药卫生 > 基础医学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2