Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

AccordionExample.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.vaadin.automatedtests.featurebrowser;
  2. import com.vaadin.ui.Accordion;
  3. import com.vaadin.ui.CustomComponent;
  4. import com.vaadin.ui.Label;
  5. import com.vaadin.ui.TextField;
  6. import com.vaadin.ui.VerticalLayout;
  7. /**
  8. * Accordion is a derivative of TabSheet, a vertical tabbed layout that places
  9. * the tab contents between the vertical tabs.
  10. */
  11. @SuppressWarnings("serial")
  12. public class AccordionExample extends CustomComponent {
  13. public AccordionExample() {
  14. // Create a new accordion
  15. final Accordion accordion = new Accordion();
  16. setCompositionRoot(accordion);
  17. // Add a few tabs to the accordion.
  18. for (int i = 0; i < 5; i++) {
  19. // Create a root component for a accordion tab
  20. VerticalLayout layout = new VerticalLayout();
  21. accordion.addComponent(layout);
  22. // The accordion tab label is taken from the caption of the root
  23. // component. Notice that layouts can have a caption too.
  24. layout.setCaption("Tab " + (i + 1));
  25. // Add some components in each accordion tab
  26. Label label = new Label("These are the contents of Tab " + (i + 1)
  27. + ".");
  28. layout.addComponent(label);
  29. TextField textfield = new TextField("Some text field");
  30. layout.addComponent(textfield);
  31. }
  32. }
  33. }