Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

HelloWorld.java 1.4KB

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