aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/demo/HelloWorld.java
blob: 0118a68d6d38e2e43a3118ee7aa311c3e4b04c41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.itmill.toolkit.demo;

import com.itmill.toolkit.ui.*;

/**
 * The classic "hello, world!" example for IT Mill Toolkit. The class simply
 * implements the abstract {@link com.itmill.toolkit.Application#init() init()}
 * method in which it creates a Window and adds a Label to it.
 * 
 * @author IT Mill Ltd.
 * @see com.itmill.toolkit.Application
 * @see com.itmill.toolkit.ui.Window
 * @see com.itmill.toolkit.ui.Label
 */
public class HelloWorld extends com.itmill.toolkit.Application {

	/**
	 * The initialization method that is the only requirement for inheriting the
	 * com.itmill.toolkit.service.Application class. It will be automatically
	 * called by the framework when a user accesses the application.
	 */
	public void init() {

		/*
		 * - Create new window for the application - Give the window a visible
		 * title - Set the window to be the main window of the application
		 */
		Window main = new Window("Hello window");
		setMainWindow(main);

		setTheme("example");
		/*
		 * - Create a label with the classic text - Add the label to the main
		 * window
		 */
		main.addComponent(new Label("Hello World!"));

		/*
		 * And that's it! The framework will display the main window and its
		 * contents when the application is accessed with the terminal.
		 */
	}
}