title: Implementing Accordion using Vaadin 6
body: <p>I am new to Java and have taken a course fundamentals for it.  Currently I am using vaadin as my framework to create a simple webapp but am running into problems with implementing the accordion.  I would like some pointers in my code, there is an error with casting accordion to component in the main app. </p>
  
  <p>My current code so far:</p>
  
  <p>Main java class: </p>
  
  <pre><code>package Main;
  import UI.Accordiontest;
  import com.vaadin.ui.SplitPanel;
  import com.vaadin.ui.VerticalLayout;
  import com.vaadin.ui.Window;
  
  
  public class test extends Application {
  
      private SplitPanel horizontalSplit = new SplitPanel(
              SplitPanel.ORIENTATION_HORIZONTAL);
      private Accordiontest accordion = new Accordiontest(this);
  
      public void init() {
          buildMainLayout();
      }
  
  
      private void buildMainLayout () {
  // error: cast accordion to Component
          horizontalSplit.setFirstComponent(accordion);
  //error end
          setMainWindow(new Window("test))'
          VerticalLayout layout = new VerticalLayout();
          layout.setSizeFull();
          layout.addComponent(horizontalSplit);
          layout.setExpandRatio(horizontalSplit, 1);
          getMainWindow().setContent(layout);
  </code></pre>
  
  <p>UI accordiontest:
     package UI;</p>
  
  <pre><code>import Main.test;
  import com.vaadin.ui.Accordion;
  import com.vaadin.ui.Label;
  
  public class Accordiontest extends test{
      public Accordiontest(test app) {
          final Accordion accordion = new Accordion();
  
          for (int i = 0; i &lt; 5;
              i++) {
          VerticalLayout layout = new VerticalLayout();
          accordion.addCOmponent(layout);
          layout.setCaption("tab" + (i + 1));
          Label label = new Label("These are the contents of Tab " + (i + 1) + ".");
          layout.addComponent(label);
          TextField textfield = new TextField("some text field");
          layout.addComponent(textfield);
           }
        } 
     }
  </code></pre>
  
  <p>thanks!</p>