Javatpoint Logo
Javatpoint Logo

GWT Custom Widget

Google Web Toolkit offers a variety of ways for creating custom widgets. The easiest way is to create composite widgets by grouping existing basic widgets and adding some interaction logic to them.

To create Custom Widget it has three general concepts to be implemented for creating custom widget which are as follows:

  1. Building Composite Widgets.
  2. Create Java Code for new widget.
  3. Wrap JavaScript using JSNI methods.

Building Composite Widgets

To create composite widget it should extend Composite Class. A composite is a specialized widget that can contain another component. It behaves as if it were its contained widget. On creating composite widget we can combine groups of existing widgets into a composite that is itself a reusable widget. 

Create Java Code for new widget

Widget is written in java language under package The source code is in gwt-user.jar. It is a complicated method to create a basic widget in this method. Many of the basic widgets are written this way, such as Button and TextBox.

Wrap JavaScript using JSNI methods

When implementing a custom widget that derives directly from the Widget base class, we write some of the widget’s methods using JavaScript. This method is implemented at last as it becomes more difficult to debug.

GWT Custom Widget Example




GWT Custom WIdget
Next TopicGWT JSNI

Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA