You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HelloWorld.java 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.itmill.toolkit.demo;
  2. import com.itmill.toolkit.ui.*;
  3. /** The classic "hello, world!" example for IT Mill Toolkit. The
  4. * class simply implements the abstract
  5. * {@link com.itmill.toolkit.Application#init() init()} method
  6. * in which it creates a Window and adds a Label to it.
  7. *
  8. * @author IT Mill Ltd.
  9. * @see com.itmill.toolkit.Application
  10. * @see com.itmill.toolkit.ui.Window
  11. * @see com.itmill.toolkit.ui.Label
  12. */
  13. public class HelloWorld extends com.itmill.toolkit.Application {
  14. /** The initialization method that is the only requirement for
  15. * inheriting the com.itmill.toolkit.service.Application class. It will
  16. * be automatically called by the framework when a user accesses the
  17. * application.
  18. */
  19. public void init() {
  20. /*
  21. * - Create new window for the application
  22. * - Give the window a visible title
  23. * - Set the window to be the main window of the application
  24. */
  25. Window main = new Window("Hello window");
  26. setMainWindow(main);
  27. /*
  28. * - Create a label with the classic text
  29. * - Add the label to the main window
  30. */
  31. main.addComponent(new Label("Hello World!"));
  32. /*
  33. * And that's it! The framework will display the main window and its
  34. * contents when the application is accessed with the terminal.
  35. */
  36. }
  37. }