Advertisement
Guest User

Gui.java

a guest
Apr 24th, 2017
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.49 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.io.*;
  6.  
  7. /**
  8.  * Created by user on 30/03/17.
  9.  */
  10. public class Gui implements ActionListener{
  11.     JFrame loginFrame = new JFrame("Your Shop");
  12.  
  13.     JFrame dashboardFrame = new JFrame("Your Shop DashBoard");
  14.     JFrame modifyProduct = new JFrame("Modify Product");
  15.     JFrame newProduct = new JFrame("New Product");
  16.     JFrame delete = new JFrame("Delete Product");
  17.  
  18.     JFrame order = new JFrame("Order");
  19.  
  20.     JLabel userNameLabel = new JLabel("User Name:");
  21.     JLabel passwordLabel = new JLabel("Enter Password:");
  22.  
  23. //    JLabel productID = new JLabel("Product ID");
  24. //    JLabel productName = new JLabel("Product NAme");
  25. //    JLabel productPrice = new JLabel("Price");
  26. //    JLabel productQuantity = new JLabel("Quantity");
  27.  
  28.     JLabel productID = new JLabel("Product ID");
  29.     JLabel productName = new JLabel("Product NAme");
  30.     JLabel productPrice = new JLabel("Price");
  31.     JLabel productQuantity = new JLabel("Quantity");
  32.  
  33.     JLabel modproductID = new JLabel("Modify Product ID");
  34.     JLabel modproductName = new JLabel("Modify  NAme");
  35.     JLabel modproductPrice = new JLabel("Modify Price");
  36.     JLabel modproductQuantity = new JLabel("Modify Quantity");
  37.  
  38.     JTextField userNameTextField = new JTextField("admin");
  39.     JTextField passwordField = new JTextField("admin");
  40.  
  41.     JTextField searchTextField = new JTextField("");
  42.     JButton clear = new JButton("Clear");
  43.  
  44.  
  45.     JLabel showProductInfo = new JLabel();
  46.  
  47.     JLabel productInfo = new JLabel();
  48.  
  49.     JTextField orderQuantity = new JTextField();
  50.  
  51.     JLabel label = new JLabel();
  52.     //JTable table = new JTable();
  53.  
  54. //    JTextField productIDtext = new JTextField("");
  55. //    JTextField productNameText = new JTextField("");
  56. //    JTextField priceText = new JTextField("");
  57. //    JTextField quantitytext = new JTextField("");
  58. //
  59. //    JTextField productIDtext = new JTextField("");
  60. //    JTextField productNameText = new JTextField("");
  61. //    JTextField priceText = new JTextField("");
  62. //    JTextField quantitytext = new JTextField("");
  63.  
  64.     JTextField productIDtext = new JTextField("");
  65.     JTextField productNameText = new JTextField("");
  66.     JTextField priceText = new JTextField("");
  67.     JTextField quantitytext = new JTextField("");
  68.  
  69.  
  70.  
  71.     JButton signIn = new JButton("Sign In");
  72.     JButton searchButton = new JButton("Search");
  73.     JButton addOrder = new JButton("Add new Order");
  74.     JButton addProducts = new JButton("Add new Product");
  75.     JButton modifyProducts = new JButton("Modify Products");
  76.     JButton deleteProducts = new JButton("Delete Products");
  77.     JButton showProduct  = new JButton("Show Products");
  78.     JButton done = new JButton("Done");
  79.     JButton back = new JButton("Back");
  80.  
  81.  
  82.     //String column[]={"ID","Name","Price","Quantity"};
  83.     int i=0;
  84.     int j;
  85.     static boolean foundProduct=false;
  86.     double price;
  87.     int quantity;
  88.  
  89.     String filename = "product.txt";
  90.     FileWriter fw = new FileWriter(new File(filename),true);
  91.     BufferedReader br = new BufferedReader(new FileReader(filename));
  92.  
  93.  
  94.     public Gui() throws IOException {
  95.  
  96.  
  97.  
  98.         loginFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  99.         loginFrame.setSize(400,400);
  100.         loginFrame.setLayout(null);
  101.         loginFrame.setVisible(true);
  102.  
  103.  
  104.         loginFrame.add(userNameLabel);
  105.         userNameLabel.setBounds(30,50,100,20);
  106.         userNameLabel.setVisible(true);
  107.  
  108.  
  109.         loginFrame.add(userNameTextField);
  110.         userNameTextField.setBounds(130,51,120,25);
  111.         userNameTextField.setVisible(true);
  112.  
  113.         loginFrame.add(passwordLabel);
  114.         passwordLabel.setBounds(30,90,100,10);
  115.         passwordLabel.setVisible(true);
  116.  
  117.  
  118.         loginFrame.add(passwordField);
  119.         passwordField.setBounds(130,91,120,25);
  120.         passwordField.setVisible(true);
  121.  
  122.  
  123.  
  124.  
  125.         loginFrame.add(signIn);
  126.         signIn.setBounds(130,140,100,30);
  127.         //passwordField.setActionCommand(String.valueOf(new Login()));
  128.         //passwordField.addActionListener(new Login());
  129.         signIn.addActionListener(new DashBoard());
  130.  
  131.     }
  132. /*    void passwordCheck(){
  133.         if( (userNameTextField.getText().equals("admin") && passwordField.getText().equals("admin")))
  134.         {
  135.             new DashBoard();
  136.             loginFrame.dispose();
  137.         }
  138.         else
  139.         {
  140.             //JOptionPane.showMessageDialog(this,"incorrect login info");
  141.             new DashBoard();
  142.             System.out.println("wrong login info");
  143.         }
  144.  
  145.     }*/
  146. /*    public class Login extends Component implements ActionListener{
  147.  
  148.         @Override
  149.         public void actionPerformed(ActionEvent e) {
  150.  
  151.             {
  152.                 passwordCheck();
  153.                 signIn.addActionListener(new DashBoard());
  154.                 loginFrame.dispose();
  155.             }
  156.             else
  157.             {
  158.                 //JOptionPane.showMessageDialog(this,"incorrect login info");
  159.                 //System.out.println("wrong login info");
  160.             }
  161.         }
  162.     }*/
  163.  
  164.     public static void main(String[] args) throws IOException {
  165.         new Gui();
  166.     }
  167.  
  168.  
  169.     @Override
  170.     public void actionPerformed(ActionEvent e) {
  171.  
  172.     }
  173.  
  174.     public class DashBoard implements ActionListener {
  175.  
  176.         @Override
  177.         public void actionPerformed(ActionEvent e) {
  178.             if ((userNameTextField.getText().equals("admin") && passwordField.getText().equals("admin"))) {
  179.                 String[] info;
  180.                 String id;
  181.  
  182.                 dashboardFrame.setVisible(true);
  183.                 dashboardFrame.setSize(600, 700);
  184.                 dashboardFrame.setLayout(null);
  185.  
  186.                 dashboardFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  187.  
  188. //            JMenuBar menuBar = new JMenuBar();
  189. //            dashboardFrame.add(menuBar);
  190. //            menuBar.setBounds(0,0,800,30);
  191. //            menuBar.setVisible(true);
  192. //            JMenuItem products = new JMenuItem("Products");
  193. //            menuBar.add(products);
  194. //            products.setBounds(0,0,100,20);
  195.  
  196.  
  197.                 dashboardFrame.add(searchTextField);
  198.                 searchTextField.setBounds(20, 50, 400, 30);
  199.  
  200.  
  201.                 dashboardFrame.add(searchButton);
  202.                 searchButton.setBounds(430, 48, 100, 30);
  203.  
  204.  
  205.                 dashboardFrame.add(addOrder);
  206.                 addOrder.setBounds(20, 100, 140, 30);
  207.                 addOrder.addActionListener(new AddOrder());
  208.  
  209.  
  210.                 dashboardFrame.add(addProducts);
  211.                 addProducts.setBounds(220, 100, 140, 30);
  212.                 addProducts.addActionListener(new AddNewProduct());
  213.  
  214.  
  215.                 dashboardFrame.add(modifyProducts);
  216.                 modifyProducts.setBounds(420, 100, 140, 30);
  217.                 modifyProducts.addActionListener(new modifyProduct());
  218.  
  219.  
  220.                 dashboardFrame.add(deleteProducts);
  221.                 deleteProducts.setBounds(420, 150, 140, 30);
  222.                 deleteProducts.addActionListener(new DeleteProduct());
  223.  
  224.                 dashboardFrame.add(showProduct);
  225.                 showProduct.setBounds(0, 201, 140, 30);
  226.                 showProduct.setVisible(true);
  227.                 showProduct.addActionListener(new ShowProducts());
  228.                 //showProduct.setBounds();
  229.                 try {
  230.                     if (br.readLine() != null) {
  231.                         try {
  232.                             id = br.readLine();
  233.                             while (id != null) {
  234.                                 info = id.split(" ");
  235.                                 Products p = new Products(info[0], info[1], Double.parseDouble(info[2]), Integer.parseInt(info[3]));
  236.                                 Store.productsArrayList.add(p);
  237.                                 id = br.readLine();
  238.  
  239.                             }
  240.                         } catch (IOException e1) {
  241.                             e1.printStackTrace();
  242.                         }
  243.                     }
  244.                 } catch (IOException e1) {
  245.                     e1.printStackTrace();
  246.                 }
  247.  
  248.                 loginFrame.dispose();
  249.  
  250.             } else {
  251.                 JOptionPane.showMessageDialog(null, "Wrong password");
  252.             }
  253.  
  254.         }
  255.         public class AddOrder implements ActionListener{
  256.  
  257.             @Override
  258.             public void actionPerformed(ActionEvent e) {
  259.                 order.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  260.                 order.setVisible(true);
  261.                 order.setSize(300,300);
  262.                 order.setLayout(null);
  263.  
  264.                 JLabel enterQuantity = new JLabel("Enter Quantity");
  265.                 enterQuantity.setBounds(0,0,100,30);
  266.                 order.add(enterQuantity);
  267.                 enterQuantity.setVisible(true);
  268.  
  269.                 orderQuantity.setVisible(true);
  270.                 order.add(orderQuantity);
  271.                 orderQuantity.setBounds(0,51,100,30);
  272.  
  273.                 order.add(done);
  274.                 done.setVisible(true);
  275.                 done.setBounds(0,101,100,30);
  276.                 done.addActionListener(new OrderModify());
  277.  
  278.  
  279.  
  280.             }
  281.         }
  282.         public class  OrderModify implements ActionListener{
  283.  
  284.             @Override
  285.             public void actionPerformed(ActionEvent e) {
  286.                 i = 0;
  287.                 try {
  288.                     while (Store.productsArrayList.get(i) != null) {
  289.                         if (Store.productsArrayList.get(i).productID.equals(searchTextField.getText())) {
  290.  
  291.                             done.addActionListener(new Modifying());
  292.                             foundProduct = true;
  293.                             dashboardFrame.dispose();
  294.                             if (foundProduct) {
  295.                                 if((Store.productsArrayList.get(i).productQuantity-=Integer.parseInt((orderQuantity.getText())))<=0)
  296.                                 {
  297.                                     done.addActionListener(new DeleteProduct());
  298.                                 }
  299.                                 Store.productsArrayList.get(i).productQuantity-=Integer.parseInt((orderQuantity.getText()));
  300.                                 j = i;
  301.                                 break;
  302.                             }
  303.                         }
  304.                         i++;
  305.                     }
  306.                 } catch (Exception e1) {
  307.                     e1.getMessage();
  308.                 }
  309.  
  310.             }
  311.         }
  312.         public class AddNewProduct implements ActionListener {
  313.  
  314.  
  315.             @Override
  316.             public void actionPerformed(ActionEvent e) {
  317.                 newProduct.setVisible(true);
  318.                 newProduct.setSize(300, 400);
  319.                 newProduct.setLayout(null);
  320.  
  321.  
  322.                 newProduct.add(productID);
  323.                 productID.setBounds(20, 40, 100, 50);
  324.  
  325.  
  326.                 newProduct.add(productName);
  327.                 productName.setBounds(20, 80, 100, 50);
  328.  
  329.  
  330.                 newProduct.add(productPrice);
  331.                 productPrice.setBounds(20, 120, 100, 50);
  332.  
  333.  
  334.                 newProduct.add(productQuantity);
  335.                 productQuantity.setBounds(20, 160, 100, 50);
  336.  
  337.  
  338.                 newProduct.add(productIDtext);
  339.                 productIDtext.getText();
  340.                 productIDtext.setText("");
  341.                 productIDtext.setBounds(120, 55, 130, 25);
  342.  
  343.  
  344.                 newProduct.add(productNameText);
  345.                 productNameText.getText();
  346.                 productNameText.setText("");
  347.                 productNameText.setBounds(120, 95, 130, 25);
  348.  
  349.  
  350.                 newProduct.add(priceText);
  351.                 priceText.getText();
  352.                 priceText.setText("");
  353.                 priceText.setBounds(120, 135, 130, 25);
  354.  
  355.  
  356.                 newProduct.add(quantitytext);
  357.                 quantitytext.getText();
  358.                 quantitytext.setText("");
  359.  
  360.                 quantitytext.setBounds(120, 175, 130, 25);
  361.  
  362.  
  363.                 JButton done = new JButton("Done");
  364.                 newProduct.add(done);
  365.                 done.setBounds(160, 260, 100, 25);
  366.                 done.addActionListener(new AddProducts());
  367.  
  368.                 JButton back = new JButton("Back");
  369.                 newProduct.add(back);
  370.                 back.setBounds(20, 260, 100, 25);
  371.  
  372.                 back.addActionListener(new DashBoard());
  373.  
  374.                 dashboardFrame.dispose();
  375.  
  376.  
  377.             }
  378.         }
  379.  
  380.         public class AddProducts implements ActionListener {
  381.  
  382.             @Override
  383.             public void actionPerformed(ActionEvent e) {
  384.  
  385.                 price = Double.parseDouble(priceText.getText());
  386.  
  387.                 quantity = Integer.parseInt(quantitytext.getText());
  388.                 Products p = new Products(productNameText.getText(), productIDtext.getText(), price, quantity);
  389.                 Store.productsArrayList.add(p);
  390.                 try {
  391.                     //PrintWriter pw = new PrintWriter(new File("product.txt"));
  392.                     //BufferedWriter bw = new BufferedWriter(new File("product.txt"),true)
  393.                     fw.write(productNameText.getText() + " " + productIDtext.getText() + " " + price + " " + quantity);
  394.                     fw.write(System.getProperty("line.separator"));
  395.                     fw.flush();
  396.  
  397.                 } catch (Exception e1) {
  398.                     e1.printStackTrace();
  399.                 }
  400.  
  401.  
  402.             }
  403.         }
  404.  
  405.         public class modifyProduct implements ActionListener {
  406.  
  407.  
  408.             @Override
  409.             public void actionPerformed(ActionEvent e) {
  410.                 modifyProduct.setVisible(true);
  411.                 modifyProduct.setSize(300, 400);
  412.                 modifyProduct.setLayout(null);
  413.  
  414.                 foundProduct = false;
  415.                 modifyProduct.add(modproductID);
  416.  
  417.                 modproductID.setBounds(20, 40, 100, 50);
  418.  
  419.  
  420.                 modifyProduct.add(modproductName);
  421.                 modproductName.setBounds(20, 80, 100, 50);
  422.  
  423.  
  424.                 modifyProduct.add(modproductPrice);
  425.                 modproductPrice.setBounds(20, 120, 100, 50);
  426.  
  427.  
  428.                 modifyProduct.add(modproductQuantity);
  429.                 modproductQuantity.setBounds(20, 160, 100, 50);
  430.  
  431.  
  432.                 modifyProduct.add(productIDtext);
  433.                 productIDtext.getText();
  434.                 productIDtext.setText("");
  435.                 productIDtext.setBounds(120, 55, 130, 25);
  436.  
  437.  
  438.                 modifyProduct.add(productNameText);
  439.                 productNameText.getText();
  440.                 productNameText.setText("");
  441.                 productNameText.setBounds(120, 95, 130, 25);
  442.  
  443.  
  444.                 modifyProduct.add(priceText);
  445.                 priceText.getText();
  446.                 priceText.setText("");
  447.                 priceText.setBounds(120, 135, 130, 25);
  448.  
  449.  
  450.                 modifyProduct.add(quantitytext);
  451.                 quantitytext.getText();
  452.                 quantitytext.setText("");
  453.  
  454.                 quantitytext.setBounds(120, 175, 130, 25);
  455.  
  456.  
  457.                 modifyProduct.add(done);
  458.                 done.setBounds(160, 260, 100, 25);
  459.  
  460.  
  461.                 modifyProduct.add(back);
  462.                 back.setBounds(20, 260, 100, 25);
  463.                 back.addActionListener(new DashBoard());
  464.  
  465.                 i = 0;
  466.                 try {
  467.                     while (Store.productsArrayList.get(i) != null) {
  468.                         if (Store.productsArrayList.get(i).productID.equals(searchTextField.getText())) {
  469.  
  470.                             done.addActionListener(new Modifying());
  471.                             foundProduct = true;
  472.                             dashboardFrame.dispose();
  473.                             if (foundProduct) {
  474.                                 j = i;
  475.                                 break;
  476.                             }
  477.                         }
  478.                         i++;
  479.                     }
  480.                 } catch (Exception e1) {
  481.                     e1.getMessage();
  482.                 }
  483.  
  484.  
  485.             }
  486.         }
  487.  
  488.         public class Modifying implements ActionListener {
  489.  
  490.             @Override
  491.             public void actionPerformed(ActionEvent e) {
  492.                 foundProduct = true;
  493.  
  494.                 price = Double.parseDouble(priceText.getText());
  495.  
  496.                 quantity = Integer.parseInt(quantitytext.getText());
  497.                 Store.productsArrayList.get(i).productName = productName.getText();
  498.                 Store.productsArrayList.get(i).productID = productName.getText();
  499.                 Store.productsArrayList.get(i).productPrice = price;
  500.                 Store.productsArrayList.get(i).productQuantity = quantity;
  501.                 System.out.println(Store.productsArrayList.get(i).productName + Store.productsArrayList.get(i).productID + Store.productsArrayList.get(i).productPrice + Store.productsArrayList.get(i).productQuantity);
  502.                 String line;
  503.                 int i=0;
  504.                 try {
  505.                     while(Store.productsArrayList.get(i)!=null)
  506.                     {
  507.                         fw.write(productNameText.getText() + " " + productIDtext.getText() + " " + price + " " + quantity);
  508.                         fw.write(System.getProperty("line.separator"));
  509.                         fw.flush();
  510.                     }
  511.                 } catch (Exception e1) {
  512.                     e1.printStackTrace();
  513.                 }
  514.                 try {
  515.                     fw.close();
  516.                 } catch (IOException e1) {
  517.                     e1.printStackTrace();
  518.                 }
  519.  
  520.             }
  521.         }
  522.  
  523.         public class DeleteProduct implements ActionListener {
  524.  
  525.             @Override
  526.             public void actionPerformed(ActionEvent e) {
  527.                 delete.setVisible(true);
  528.                 delete.setSize(300, 400);
  529.                 delete.setLayout(null);
  530.                 i = 0;
  531.                 try {
  532.                     while (Store.productsArrayList.get(i) != null) {
  533.                         if (Store.productsArrayList.get(i).productID.equals(searchTextField.getText())) {
  534.                             delete.add(label);
  535.                             label.setVisible(true);
  536.                             label.setBounds(0,0,300,30);
  537.                             label.setText(Store.productsArrayList.get(i).productName + " " + Store.productsArrayList.get(i).productID + " " + Store.productsArrayList.get(i).productPrice + " " + Store.productsArrayList.get(i).productQuantity);
  538.                             done.addActionListener(new Modifying());
  539.                             foundProduct = true;
  540.                             dashboardFrame.dispose();
  541. /*                            File tempFile = new File("temp.txt");
  542.                             File prevFile = new File("product.txt");
  543.                             BufferedWriter bw = new BufferedWriter(new FileWriter(tempFile));
  544.  
  545.                             String lineToRemove =Store.productsArrayList.get(i).productName + " " + Store.productsArrayList.get(i).productID + " " + Store.productsArrayList.get(i).productPrice + " " + Store.productsArrayList.get(i).productQuantity;
  546.                             String currentLine;
  547.                             while((currentLine = br.readLine()) != null) {
  548.                                 // trim newline when comparing with lineToRemove
  549.                                 String trimmedLine = currentLine.trim();
  550.                                 if(trimmedLine.equals(lineToRemove)) continue;
  551.                                 bw.write(currentLine + System.getProperty("line.separator"));
  552.                             }
  553.                             bw.close();
  554.                             br.close();
  555.                             tempFile.renameTo(prevFile);*/
  556.  
  557.  
  558.                             if (foundProduct) {
  559.                                 File inputFile = new File("product.txt");
  560.                                 File tempFile = new File("temp.txt");
  561.  
  562.                                 BufferedReader reader = new BufferedReader(new FileReader(inputFile));
  563.                                 BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile));
  564.  
  565.                                 String lineToRemove = Store.productsArrayList.get(i).productName + " " + Store.productsArrayList.get(i).productID + " " + Store.productsArrayList.get(i).productPrice + " " + Store.productsArrayList.get(i).productQuantity;
  566.                                 String currentLine;
  567.  
  568.                                 while((currentLine = reader.readLine()) != null) {
  569.                                     // trim newline when comparing with lineToRemove
  570.                                     String trimmedLine = currentLine.trim();
  571.                                     if(trimmedLine.equals(lineToRemove)) continue;
  572.                                     writer.write(currentLine + System.getProperty("line.separator"));
  573.                                 }
  574.                                 //writer.close();
  575.                                 //reader.close();
  576.                                 boolean successful = tempFile.renameTo(inputFile);
  577.                                 writer.close();
  578.                                 reader.close();
  579.                                 Store.productsArrayList.remove(i);
  580.                                 j = i;
  581.                                 break;
  582.                             }
  583.                         }
  584.                         i++;
  585.                     }
  586.                 } catch (Exception e1) {
  587.                     e1.getMessage();
  588.                 }
  589.                 if(!foundProduct)
  590.                 {
  591.                     delete.add(label);
  592.                     label.setVisible(true);
  593.                     label.setBounds(0,0,300,30);
  594.                     label.setText("Not Found");
  595.                 }
  596.  
  597.                 dashboardFrame.dispose();
  598.             }
  599.         }
  600.  
  601.         public class ShowProducts implements ActionListener {
  602.  
  603.             @Override
  604.             public void actionPerformed(ActionEvent e) {
  605.                 i = 0;
  606.                 int y =251;
  607.  
  608.  
  609.    /*             if(Store.productsArrayList!=null)
  610.                 {
  611.                     try{
  612.                         for(i=0;Store.productsArrayList.get(i)!=null;i++){
  613.  
  614.                             dashboardFrame.add(label);
  615.                             label.setVisible(true);
  616.                             label.setBounds(0,y,100,30);
  617.                             label.setText("");
  618.                             y+=30;
  619.  
  620.  
  621.                         }
  622.                     } catch (Exception e2){
  623.  
  624.                     }*/
  625.                     y=251;
  626.                     String product = "";
  627.                     try{
  628.                         for(i=0;Store.productsArrayList.get(i)!=null;i++){
  629.  
  630.  
  631.                             /*label.setText(Store.productsArrayList.get(i).productName + " " + Store.productsArrayList.get(i).productID + " " + Store.productsArrayList.get(i).productPrice + " " + Store.productsArrayList.get(i).productQuantity);
  632.                             */
  633.                             product+=Store.productsArrayList.get(i).productName + " " + Store.productsArrayList.get(i).productID + " " + Store.productsArrayList.get(i).productPrice + " " + Store.productsArrayList.get(i).productQuantity+"\n";
  634.                             y+=30;
  635.  
  636.  
  637.                         }
  638.                     } catch (Exception e2){
  639.  
  640.                     }
  641.                 dashboardFrame.add(label);
  642.                 label.setVisible(true);
  643.                 label.setBounds(0,251,500,300);
  644.                 label.setText(convertToMultiline(product));
  645.                 //label.setText(product);
  646.                 //label.
  647.  
  648.             }
  649.  
  650.         }
  651.         public String convertToMultiline(String forMultiline){
  652.             return "<html>"+forMultiline.replace("\n","<br>");
  653.         }
  654.         void showProductInfo() {
  655.             int y = 251;
  656.             if (Store.productsArrayList != null) {
  657.  
  658.  
  659.                 try {
  660.                     for (i = 0; Store.productsArrayList.get(i) != null; i++) {
  661.                         dashboardFrame.add(showProductInfo);
  662.                         showProductInfo.setVisible(true);
  663.                         showProductInfo.setBounds(0, y, 100, 30);
  664.                         showProductInfo.setText(Store.productsArrayList.get(i).productName + " " + Store.productsArrayList.get(i).productID + " " + Store.productsArrayList.get(i).productPrice + " " + Store.productsArrayList.get(i).productQuantity);
  665.                         y += 30;
  666.                     }
  667.                 } catch (Exception e2) {
  668.  
  669.                 }
  670.             }
  671.  
  672.         }
  673.  
  674.  
  675.     }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement