This tutorial will teach you how to make a Beer Shop Inventory Management System in Java step by step. This system will helpful you to learn Inventory Management System.
Paste the Code inside the Add Button
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | DefaultTableModel m; int sum = 0; if(txtKing.isSelected()) { String kingfish = "King Fisher"; int price = 200; int qty = Integer.parseInt(txtKgQty.getText()); int tot = price * qty; m = (DefaultTableModel)jTable1.getModel(); m.addRow(new Object[] { kingfish, price, qty, tot } ); } if(txtHay.isSelected()) { String Haywards = "Haywards"; int price = 100; int qty = Integer.parseInt(txtHayQty.getText()); int tot = price * qty; m = (DefaultTableModel)jTable1.getModel(); m.addRow(new Object[] { Haywards, price, qty, tot } ); } if(txtRoyal.isSelected()) { String Royal = "Royal Challenge"; int price = 300; int qty = Integer.parseInt(txtRoyQty.getText()); int tot = price * qty; m = (DefaultTableModel)jTable1.getModel(); m.addRow(new Object[] { Royal, price, qty, tot } ); } if(Knock.isSelected()) { String Knock = "Knock Out"; int price = 350; int qty = Integer.parseInt(txtKnoQty.getText()); int tot = price * qty; m = (DefaultTableModel)jTable1.getModel(); m.addRow(new Object[] { Knock, price, qty, tot } ); } for(int i=0; i<jTable1.getRowCount(); i++) { sum = sum + Integer.parseInt(jTable1.getValueAt(i, 3).toString()); } txtPay.setText(Integer.toString(sum)); |
i have attached the video link below. which will do this tutorials step by step