title: Java How do I pass interface as parameter in Constructor?
body: <p>I am creating a Composite widgets that have been used in GWT Showcase.</p>
  
  <pre><code>new DialogBoxWidget(constants);
  </code></pre>
  
  <p>//Here I am stucked with error : The constructor DialogBoxWidget(ShowcaseConstants) is undefined.</p>
  
  <pre><code>/**
  * Constants used throughout the showcase.
  */
  public interface ShowcaseConstants extends MenuConstants,       
  CwDialogBox.CwConstants{
       /**
        * The path to source code for examples, raw files, and style definitions.
        */
    String DST_SOURCE = "gwtShowcaseSource/";
  }
  </code></pre>
  
  <p>Here is my DialogBoxWidget.java that is Composite</p>
  
  <pre><code> @ShowcaseSource
  public static interface CwConstants extends Constants {
      String cwDialogBoxCaption();
  
      String cwDialogBoxClose();
  
      String cwDialogBoxDescription();
  
      String cwDialogBoxDetails();
  
      String cwDialogBoxItem();
  
      String cwDialogBoxListBoxInfo();
  
      String cwDialogBoxMakeTransparent();
  
      String cwDialogBoxName();
  
      String cwDialogBoxShowButton();
  }
  
  /**
   * An instance of the constants.
   */
  @ShowcaseData
  private final CwConstants constants;
  
  /**
   * Constructor.
   * @param constants2 
   *
   * @param constants the constants
   */
  public DialogBoxWidget(CwConstants constants) {
  
      // Add a hyper link to each section in the Widgets category
      ShowcaseConstants allConstants = GWT.create(ShowcaseConstants.class);
      this.constants = constants;
      // Create the dialog box
      final DialogBox dialogBox = createDialogBox();
      dialogBox.setGlassEnabled(true);
      dialogBox.setAnimationEnabled(true);
  
      // Create a button to show the dialog Box
      Button openButton = new Button(
              allConstants.cwDialogBoxShowButton(), new ClickHandler() {
                  public void onClick(ClickEvent sender) {
                      dialogBox.center();
                      dialogBox.show();
                  }
              });
  
      // Create a ListBox
      HTML listDesc = new HTML(
              "&lt;br&gt;&lt;br&gt;&lt;br&gt;" + allConstants.cwDialogBoxListBoxInfo());
  
      ListBox list = new ListBox();
      list.setVisibleItemCount(1);
      for (int i = 10; i &gt; 0; i--) {
          list.addItem(allConstants.cwDialogBoxItem() + " " + i);
      }
  
      // Add the button and list to a panel
      VerticalPanel vPanel = new VerticalPanel();
      vPanel.setSpacing(8);
      vPanel.add(openButton);
      vPanel.add(listDesc);
      vPanel.add(list);
      initWidget(vPanel);
  }
  </code></pre>
  
  <p>Below is the code of onModuleLoad()</p>
  
  <pre><code>ShowcaseConstants constants = GWT.create(ShowcaseConstants.class);
   @ShowcaseSource
  public void onModuleLoad() {
  
      DialogBoxWidget dialogBox = new DialogBoxWidget(constants);//Here I am stucked with error : The constructor DialogBoxWidget(ShowcaseConstants) is undefined
      //Add it to the RootPanel.
      RootPanel.get().add(dialogBox);
  }
  </code></pre>