title: Calling a Constructor method in a GUI
body: <p>I am currently working on an assignment and I am looking for some help. I was given a class called ProductButton and instructed to finish the constructor method. The javadoc are as follows:</p>
  
  <pre><code>/**
  Creates a button that will display an image of the product
  (assumed to be stored in a file starting with the specified
  name and ending with ".jpg"), the specified product name,
  and the specified price (formatted properly); the text is 
  displayed below the image and is centered.
  @param name The product name.
  @param price The selling price for this product.
  */
  </code></pre>
  
  <p>In addition, I am to create a driver program. I have the majority of the driver finished, as I am not looking for help with the formatting, layout, or responses to the actions, but how I would create the constructor and call it in my GUI driver to be properly created. I am a first time java user and this is, in a way, foreign to me. Thanks for any help!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Here is what I have tried so far;</p>
  
  <pre><code>    public ProductButton (String name, double price) {
      productName = name;
      productPrice = price;
  
      NumberFormat formatter = NumberFormat.getCurrencyInstance();
  
      ImageIcon Icon = new ImageIcon(getName() + ".JPG");
      JButton Button = new JButton(getName() + "" + formatter.format(getPrice()), Icon);
      Button.setVerticalTextPosition(AbstractButton.BOTTOM);
      Button.setHorizontalTextPosition(AbstractButton.CENTER);
  </code></pre>