Advertisement
damoncard

Table2

May 2nd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.35 KB | None | 0 0
  1. package Stock;
  2.  
  3. public class Add extends javax.swing.JFrame {
  4.  
  5.     /**
  6.      * Creates new form Add
  7.      */
  8.     public Add() {
  9.         initComponents();
  10.         this.setLocationRelativeTo(null);
  11.     }
  12.  
  13.     private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                      
  14.       String id = jTextField1.getText();
  15.       String p = jTextField2.getText();
  16.       String kp = jTextField3.getText();
  17.       String kc = jTextField4.getText();
  18.       String ka = jTextField5.getText();
  19.  
  20.       if (id.equals("") || p.equals("") || kp.equals("") || kc.equals("") || ka.equals(""))
  21.       {
  22.        JOptionPane.showConfirmDialog(null,"Plese fill all informations", "Fail", JOptionPane.DEFAULT_OPTION);
  23.       }
  24.       else if (findProduct(id, true))
  25.       {
  26.        JOptionPane.showConfirmDialog(null,"Sorry, product is already in stock", "Fail", JOptionPane.DEFAULT_OPTION);
  27.       } else {
  28.        int price = Integer.parseInt(kp);
  29.        int cost = Integer.parseInt(kc);
  30.        int re = price - cost;
  31.        int amount = Integer.parseInt(ka);
  32.        addProduct(id, p, price, cost,re , amount);
  33.        JOptionPane.showConfirmDialog(null,"Add complete", "Successful", JOptionPane.DEFAULT_OPTION);
  34.        // updateTable(true) <-- Not Found
  35.        this.setVisible(false);
  36.       }
  37.     }                                    
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement