8.5. GUI ClassesThe main purpose of the onModuleLoad() method is to build the GUI and handle the button's click event. Most of the GUI classes derive from the com.google.gwt.user.client.ui package, a part of the GWT API. For example, the code uses a FormPanel and places a Grid or HTML table inside the form in order to position the Labels, TextBoxes, and Button. NOTE
The code instantiates a few of the GUI elements, a FormPanel and a Grid, outside of the onModuleLoad() method. In other words, they are instance variables rather than local variables. As a result, a JUnit test-case class can use a getter method to access the Grid, for instance, and test the state of the widgets inside of it. The TextBoxes cannot be edited by the user, since they only have a display purpose (TextBox.setEnabled(false)). |