예제 #1
0
  /** Constructor for objects of class Cart_Add */
  public Cart_Add(int itemID) {
    this.setLayout(null);
    this.setMaximumSize(new Dimension(1400, 50));
    product = invAccess.GetProductInfo(itemID);
    /** Create the DAO here */
    name = new JLabel(product.getName());
    discount = new JTextField();
    discount.setText(String.valueOf(product.getDiscount()));

    add.addActionListener(this);

    /** Absolute Positioning of the components */
    Insets insets = this.getInsets();
    /** The dimentsions of the JPanel */
    this.add(name);
    name.setBounds(25 + insets.left, 15 + insets.top, 250, 25);
    this.add(discount);
    discount.setBounds(125 + insets.left, 15 + insets.top, 75, 25);
    this.add(add);
    add.setBounds(250 + insets.left, 15 + insets.top, 85, 25);

    // this.setBorder (BorderFactory.createLineBorder(Color.black));
    product = invAccess.GetProductInfo(itemID);

    this.setVisible(true);
  }