网上书店完整代码
附录附录 全部源代码全部源代码 packageclass Connect { } packageclass docMenuAction implements ActionListener { RegisterFrame register null; JPanel cusPanel null; JPanel docPanel null; public docMenuActionRegisterFrame register{ register; private static Connection con null; private static String url“jdbcoraclethinlocalhost1521ORCL“; private static String driver ““; private static String user “scott“; private static String pwd “tiger“; public static Connection getConnection{ } public static void mainString[] args { } ; try { driver; con url, user, pwd; “数据库连接成功“; } catch ClassNotFoundException e { “驱动加载失败“;; } catch SQLException e { } return con; “数据库连接失败“; } ; ; public void actionPeredActionEvent e { 于用户搜索商品 public ArrayList getAllSellerGoods{ ArrayList list new ArrayList; conn ; try { statement ; String sql “select * from goods a,seller b where “; resultSet sql; while{ Seller seller new Seller; “seller_name“; “address“; Goods goods new Goods; seller; “goods_id“; “goods_name“; “seller_id“; “discount“; “num“; “price“; 2012-9-192012-9-192012-9-192012-9-19etImage; null; null; false; etImage; } 600, 400; ; null; menuBar,; setGoodsPanel; ; goodsPanel,; ; setSouthPanel; setOrderPanel; southPanel,; quals{ null, “请输入商品编号或商品数量“; }else{ int id ; int num String ; goods id; ifnull, “您确定要购买吗“0{ if0{ null, “商品编号输入错误“; }else{ ifnum{ null, “商品数量不足“; }else{ -num; goods; OrderDao order new OrderDao; goods, num; null, “购买成功“; setAr; setOr; } }; } } } } ; }else{ } etName; } private void setArNull{ } forint i0;i;i{ } forint j0;jar[i].length;j{ } ar[i][j]““; } ar[i][7].getAddress; } etName; } private void setOrNull{ } public static void mainString[] args { } BuyerFrame frame new BuyerFrame; true; forint i0;i;i{ } forint j0;jor[i].length;j{ } or[i][j]““; } or[i][3].getPrice; or[i][4].getDiscount; or[i][5].getPrice*.getDiscount*; or[i][6]; or[i][7].getName; or[i][8].getAddress; packageclass LoginFrame extends JFrame{ private JLabel userNameLabel new JLabel“用户名“; private JLabel pwdLabel new JLabel“密 码“; private JTextField useNameText new JTextField; private JPasswordField pws new JPasswordField; private JLabel roleLabel new JLabel“角色“; private JComboBox roleBox new JComboBoxnew String[]{“ 商家“,“买家“}; private JButton bt new JButton“确定“; private JButton btR new JButton“取消“; private String flag null; public LoginFrame{ } private void init{ 320, 280; “登录“; new ImageIcon“images/“.getImage; null; false; ; null; 40, 20, 150, 30; userNameLabel; 120, 20, 150, 30; useNameText; 40, 80, 150, 30; pwdLabel; 120, 80, 150, 30; pws; 40, 140, 70, 30; roleLabel; 120, 140, 150, 30; init; roleBox; 40, 200, 70, 30; btR; new ActionListener { Overr