Before anything else, make sure to set the path to the GWT installation directory in the Preferences window. GWT Designer will prompt you if this has not been set.
 |
Select File > New >
Project from the Eclipse toolbar to open the new project wizard dialog. Select Designer > GWT > GWT Java Project from the list of wizards. Click Next.
 |
Enter LoginManager as the Project name and click Next.

|
Check the option to Create a GWT Module. Enter LoginManager as the Module name. Modify the package name to com.mycompany.tutorial.
Keep the Create EntryPoint and public resources option checked
Select the Use new GWT bootstrap option Click Finish.
 |
GWT Designer generates the project with all of the necessary configuration and resource
files. The module LoginManager.java is opened in source mode by default. Click the Design tab at the bottom of the source editor.

|
This is the LoginManager in Design mode. This is the initial module created by GWT Designer.
 |
Create a Composite for the Login application. Select the Designer toolbar button and select GWT > Composite from the pull-down menu.

|
Enter Login as the name of the Composite. Click Finish. Click the Design tab.
 |
You should now see an empty composite.

|
Add a VerticalPanel to the Composite.
- To do this, select the VerticalPanel from the Palette and click on the Login Composite. You should now see an Empty VerticalPanel.
Add a label widget to the Composite.
- Select Label from the Palette and add it to the content area.
On the Properties tab, set the text property to Sign in to your account.
 |
To easily structure the widgets, add a FlexTable panel.
- Select Flextable under Panels within the Palette and add it to the Composite inside the VerticalPanel.

|
Add the following widgets and arrange it as seen on the screen shot:
- Add a Label and change the text property to Username:
- Add a TextBox and change the variable property to textBoxUsername.
- Add another Label and change the text property to Password:
- Add another TextBox and change the variable property to textBoxPassword.
- Add a CheckBox and change the text property to Remember me on this computer.
- Add a Button below the checkbox and set the text property to Sign In.
Save your work.
 |
Select one of the labels and click on the ellipsis on the styleName property.
 |
That brings up the CSS Style Selection dialog. Click on the Add... button. On the New rule dialog, click OK.

|
A new css class is added called .gwt-Label. With the .gwt-Label selected, click the Edit... button.
 |
The CSS graphical editor dialog comes up. Feel free to set any attribute you want. When you're done, click OK. Following the same procedure, create a css style for the checkbox.
 |
Double-click on the LoginManager.css file in your public folder to see the generated css styles.
 |
This is how the Login looks like with some css styling. Make sure to Save your work.
 |
Add Eventhandler.
- Right-click the Sign In button.
- Select Add event handler > click > onClick.
The
Designer switched to Source view. As you can see a ClickListener has
been added. All you have to do is implement the onClick event.
 |
Implement the onClick event. Type or copy and paste the following code: You may need to add an import statement:
import com.google.gwt.user.client.Window; if (textBoxUsername.getText().length() == 0 || textBoxPassword.getText().length() == 0) {
Window.alert("Username or password is empty."); } 
|
Open the LoginManager class in Design mode and delete the initial Click me! button. You should now see an empty module with the default rootPanel.
 |
Add a HorizontalPanel within the rootPanel. Drag the bottom right corner of the HorizontalPanel to make it bigger. Add a VerticalPanel to the HorizontalPanel. Add a Label to the VerticalPanel. Set the text property to Welcome to my login page.

|
Select Choose Widget from the Palette. In the Choose Widget dialog, type Login and click OK.

|
Place the widget in the LoginManager inside the HorizontalPanel as shown. Click Save.
 |
In
the Package explorer, right-click the LoginManager and select Run As
> GWT Application. This will create a launch configuration and run
the application locally. Click on the Sign In button.
 |
Right click on LoginManager and select Google Web Toolkit > Deploy module
 |
Specify the server deployment options and click OK. For more information on deployment, see the GWT Module Deployment documentation. For more information on deploying to your server, see the Google Website and forums.

|