可按Ctrl+D收藏 蚂蚁资源网

蚂蚁资源网

java超市管理系统(超市后台管理系统)

  • 全部评论(3)
  • nij
  • 包裹untitled5;导入java.io. *;导入java.sql。 *;导入java.lang。 *;导入java.sql。 *;导入java.awt。 *;导入java.awt。事件 *;。导入javax.swing * ;.导入com.borlland.jbcl.layout * ;.公共类DelBook扩展了Jframe {JPanel ContentPane; xylayout xylayout1 =新的xylayout(); jlabel jlabel1 = new jlabel(); jlabel jlabel2 = new jlabel(); jlabel jlabel3 = new jlabel(); jtextfield jtextfield1 = new jtextfield(); jlabel jlabel4 = new jlabel(); jtextfield jtext riffic2 = new jtextfield(); jlabel jlabel5 = new jlabel(); jtextfield jtext riffic3 = new jtextfield(); jlabel jlabel6 = new jlabel(); JTextField JTextField4 = new jtextfield(); jbutton jbutton1 =新jbutton(); //构造框架公共删除删除(){eneratevents(awtevent.window_event_mask);尝试{JBINIT(); catch(例外e){e.printStacktrace();} //组件初始化私有void jbinit()返回异常{contentpane =(jpanel)this.getContentPane(); jlabel1.setfont(新java.awt.font(“Sansserif”,0,25)); jlabel1.setforeground(color.red); jlabel1.settext(“超市管理系统”); contentpane.setLayout(XYLATOUT1);这个.stesize(新维度(500,400));这个。(“超市管理系统”); jlabel2.setfont(新java.awt.font(“Sansserif”,0,30)); jlabel2.settext(“业务单位信息”); jlabel3.setfont(新java.awt.font(“Sansserif”,0,25)); jlabel3.settext(“产品编号)); jtextfield1.settext(”“); jlabel4.setfont(新java.awt.font(”sansserif“,0,25)); jlabel4.settexttext(”公司名称“); jtextfield2 .settext(“”); jlabel5.sEtfont(新java.awt.font(“Sansserif”,0,25)); jlabel5.settext(“订单号); jtextfield3.settext”“); jlabel6.setfont(new java.awt.font(”sansserif“,0,25)); jlabel6.settext(”手机“); jtextfield4.settext( “”); jbutton1.setfont(新java.awt.font(“sansserif”,0,25)); jbutton1.settext(“提交”); jbutton1.addactionlistener(新删除delbook_jbutton1_actionadapter(此)); contentpane.add(jlabel1 ,新的XyConstraints(179,153,32)); ContentPane.add(Jlabel2,新的XyConstraints(162,33,-1,-1)); ContentPane.add(Jlabel3,新XyConstraints(83,89,-1 ,-1)); contentpane.add(JTextField1,新XyConstraints(189,88,141,36)); ContentPane.Add(JTextField2,新XyConstraints(189,149,142,36)); ContentPane.Add(JLabel4,新的XyConstraints(84,148,-1,-1)); contentpane.add(jtextfield3,新XYConstraints(188,206,143,33); ContentPane.add(JLabel5,新XyConstraints(84,204,-1,-1)); ContentPane.add(Jlabel6,新XyConstraints(84,253,-1,-1))); ContentPane.add(JTextField4,新XyConstraints(189,260,143,36)); ContentPane.Add(JButton1,新XyConstraints(197,318,-1,-1));} //覆盖,所以当窗口被关闭时,我们可以退出受保护的void processwindowevent(windowEvent e){super.processwindowevent(e); if(e.getId()== windowEvent.window_closing){system.exit(0);}}} void update(){try {// string string str1的定义;字符串str2;字符串str3;字符串str4; str1 = jtextfield1.gettext(); str2 = jtextfield2.gettext(); str3 = jtextfield3.gettext(); str4 = jtextfield4.gettext(); //加载JDBC驱动程序String DriverName =“Oracle.jdbc.oraclEdriver“; Driver Driver =(驱动程序)class.forname(drivername).newinstance(); //连接到数据库连接con = drivermanager.getConnection(”JDBC:Oracle:薄:@ Thsspc0791:1521:liuyong“,”HR “,”同方“); PreparedStatement Pstmt = con.prepleStatement(”插入uperate1('goodid','名称','pid','tel')值(?,?,?,?)“); pstmt.setstring (1,str1); pstmt。setString(2,str2); pstmt.setstring(1,str3); pstmt.setstring(4,str4); suckueset res = pstmt.executequery(); pstmt.close();骗局。关闭();} catch(实例化)e){system.out.println(e.getMessage());捕获(LygalAccessException e){system.out.println(e.getmessage());捕获(classnotfoundexcection e ){system.out.println(e .getmessage());捕获(sqlexception edd){edd.printstacktrace(); system.out.println(edd.getmessage());}}}}}}} void jbutton1_actionPerformed(ActionEvent e){update();}}类删除();}} class delbook_jbutton1_actionodationatimsing java.awt.event.actionListener {delbook Adaptee; delbook_jbutton1_actionAdapter(delbook Adaptee){this.adaptee = Adaptee;}公共void ActionPerformed(ActionEvent e){adaptiee.jbutton1_actionPerformed(e);}}}}}包untitled5;导入java.awt * ;.导入java.awt.event * ;.导入javax.swing * ;.导入com.borland .jbcl.layout *; / ** * 标题:。 *描述:*版权所有:版权所有:版权所有©2003 *公司:* @author不归属* @version 1.0 * / public类Retur扩展Jframe {JPanel ContentPane; xylayout xylayout1 =新的xylayout(); jlabel jlabel1 = new jlabel(); //构造框架公共Retur(){enablevents(awtevent.window_event_mask);尝试{J.binit();} catch(例外e){e.printstacktrace();} //组件初始化私有void jbinit()抛出异常{contentpane =(jpanel)this.getContentPane(); jlabel1.setfont(新java.awt.font(“Sansserif”,0,20)); jlabel1.setforeground(color.red jlabel1.settext(“超市管理系统”); contentpane.setlayout(xylayout1); this.setsize(新的尺寸(400,300)); this.settitle(“超市管理系统”); contentpane; contentpane .dd(jlabel1,新xyconsts(139,126,33));} //覆盖,所以当窗口被关闭时,我们可以退出受保护的void processwindowevent(windowEvent e){super.processwindowevent(e); if(e.getId ()== WindowEvent.WINDOW_CLOSING){System.exit(0);}}} *包;进口java.net。*;导入的java.sql *;导入的java.lang。*;导入javax.sql中*。推动t java .awt。 *;导入java.awt.Event。 *;导入javax.swing。 *;导入com.borllod.jbcl.layout。 *;导入com.borllod.dbswing。 *; //商品信息注册公共类FRAME2扩展公共类FRAME2扩展JLABEL JLABEL1 = NEW JLABEL(); xylayout xylayout1 =新的xylayout(); jlabel jlabel2 = new jlabel(); jlabel jlabel3 = new jlabel(); jtextfield jtextfield1 = new jtextfield(); jlabel jlabel4 = new jlabel(); jtextfield jtext riffic2 = new jtextfield(); jpanel jpanel1 = new jpanel(); xylayout xylayout2 = new xylayout(); jscrollpane jscrollpane1 = new jscrollpane(); jlabel jlabel5 = new jlabel(); jtextfield jtext riffic3 = new jtextfield(); //构造框架公共框架2(){enablevents(awtevent.window_event_mask);尝试{jbinit();}捕获(例外e){e.printstAcktrace();}} //组件初始化私有void jbinit()返回异常{contentpane =(jpanel)this.getContentPane(); contentpane.setLayout(XYLATOUT1);这个.stingsize(新维度(600,500));这个。(“超市管理系统”); this.addhierarchyboundslistener(新帧2_this_hierarchyboundsadapter(此)); jlabel1.setfont(新java.awt.font(“sansserif”,0,25); jlabel1.setforeground(color.red); jlabel1.settext(“超市管理系统”); contentpane.setforeground(color.black); jlabel2 .setfont(新java.aw.字体(“sansserif”,0,30); jlabel2.settext(“产品信息显示”); // statusbar.setfont(new java.awt.font(“sansserif”,0,20 )); jlabel3.setfont新java.awt.font(“Sansserif”,0,20)); jlabel3.settext(“产品名称”); jtextfield1.settexT(“”); jlabel4.批评(真); jlabel4.setfont(新java.aw .font(“sansserif”,0,20); jlabel4.settext(“产品ID号”); jtextfield2.settext(“”); jtextfield2.adactionListener(新帧2_jtextField2_ActionAdapter(此)); jpanel1.setLayout(xylayout2); jlabel5.setfont(新java.awt.font(“sansserif”,0,25); jlabel5.setforeground(color.red); jlabel5.settext(“本产品详细信息”); jtextfield3.settext (“”); contentpane.add(jlabel1,新xyconstraints(237,0,153,40); contentpane.add(jlabel2,new xyconstraints(200,47,231,58)); contentpane.add(jlabel3,新的xyconstraints (47,102,14,42)); contentpane.add(JTextField1,新XyConstraints(128,108,112,34)); ContentPane.add(JTextField2,新XyConstraints(361,107,109,36)); ContentPane .dd(jpanel1,新xyconsts(75,166,453,277))); jpanel1.add(Jscrollpane1,新XyConstraints(14,8,433,221)); jscrollpane1.getViewPort()。添加(jtextfield3,null); jpanel1.add(Jlabel5,新XyConstros(112,240,-1,-1)); ContentPane.Add(Jlabel4,新XyConstraints(278,111,-1,-1));} //覆盖,以便在窗口被关闭时退出受保护的void processwindowevent(windowEvent e){super.processwindowevent(e); if(e.getId()== windowevent.window_closiing){system.exit(0);}} void select()}尝试{string str1,str2; str1 = jtextfield1.gettext(); str2 = jtextfield2.gettext();
  • 2021-09-02 12:54:38
  • lyrhc
  • 导入java.sql.connection;导入java.sql.drivermanager;导入java.sql.resultset;导入java.sql.sqlexception;导入java.sql.statement;公共类conn {私有静态最终字符串驱动程序=“com.mysql。jdbc.driver”;私有静态最终字符串URL =“jdbc:mysql:// localhost:3306 / blog?user = root&password = root”; //获取数据库连接公共静态连接GetConnection(){Connection Conn = null;尝试{class.forname(驱动程序); conn = drivermanager.getConnection(URL); if(conn!= null){system.out.print(“成功”);}} catch(sqlexception e){e.printstacktrace();} catch(classnotfoundexception e){e.printstacktrace();} return conn; close结果集公共静态void ticeEresultset(Rs!= null){rcc(= null){rclose();}} catch(sqlexception ex){ex.printstacktrace();}} // tword语句公共静态void closement(语句st){{i(st!= null){st.close(); catch(sqlelception ex){ex.printstacktrace();} //关闭连接公共静态void closeConnection(连接conn){if(conn!= null){conn.close();}} catch(sqlexception ex) ){ex.printStacktrace();}} //测试数据库连接成功公共静态void main(String [] args){conn.getconnection();}}
  • 2021-09-02 12:52:38
  • 源码资源网
  • 做了个java超市管理系统,其中有一个功能就是生成账单号,可每次重启系统账单号就会又从零开始累加,,用数据库表主键存账单号吧,否则如果你的程序两个或者多个一起跑的话,账单号会更加混乱
  • 2021-09-02 12:52:38
  • 商品推荐