Do you think IIT Guwahati certified course can help you in your career?
No
Introduction🌼
The Horizontal Panel in GWT represents a panel that lays all of its widgets out in a single Horizontal Column. This GWT Horizontal Panel Widget can be used to create complex layouts with a single horizontal column. Now let's see its class declaration along with other properties like class construction and methods.
A panel with all of its widgets arranged in a single horizontal column.
In this example, we look for the usage of a Horizontal Panel Widget in GWT in simple steps. Now let's have a look at the step-wise construction of the GWT Horizontal Panel Widget.
Step 1: We’ll start off by creating a project with the name Horizontal Panel Widget under a package com.codingninjas.
Step 2: Then change the HorizontalPanelWidget.gwt.xml, HorizontalPanelWidget.css, HorizontalPanelWidget.html, and HorizontalPanelWidget.java as explained below.
Step 3: Now, Compile and run the application to get the output
Here’s the content of the modified module descriptor src/com.codingninjas/HorizontalPanelWidget.gwt.xml.
<?xml version = "1.0" encoding = "UTF-8"?>
<module rename-to = 'HorizontalpanelWidget'>
<inherits name = 'com.google.gwt.user.User'/>
<inherits name = 'com.google.gwt.user.theme.clean.Clean'/>
<entry-point class = 'com.codingninjas.client.HorizontalpanelWidget'/>
<source path = 'client'/>
<source path = 'shared'/>
</module>
Content of the modified Style Sheet file war/HorizontalpanelWidget.css.
Let us have the following content of the Java file src/com.codingninjas/HorizontalpanelWidget.java, which will demonstrate the use of the HorizontalPanel widget.
package com.codingninjas.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.RootPanel;
public class HorizontalpanelWidget implements EntryPoint {
public void onModuleLoad() {
HorizontalPanel horizontalPanel = new HorizontalPanel();
for(int i = 1; i <= 5; i++){
CheckBox checkBox = new CheckBox("Element " + i);
horizontalPanel.add(checkBox);
}
DecoratorPanel decoratorPanel = new DecoratorPanel();
decoratorPanel.add(horizontalPanel);
/* Add the widgets to the root panel. */
RootPanel.get().add(decoratorPanel);
}
}
Output:
Frequently Asked Questions
What is GWT?
GWT (Google web toolkit) is an open-source development toolkit provided by google for developing browser-based, complex Ajax applications. We can even develop Rich Internet Applications (RIA) in Java using GWT, which will then be compiled into Javascript and cross-browser compliant.
What is GWT Horizontal Panel Widget?
The HorizontalPanel widget represents a panel that lays all of its widgets out in a single Horizontal Column. This lays all of its widgets out in a single horizontal column.
What characteristics does GWT have?
Asynchronous remote procedure calls, history management, bookmarking, UI abstraction, internationalization, and cross-browser portability.
Who uses GWT - Google Web Toolkit?
Companies like Crimsonlogic Pte. Ltd., StudyBlue Inc., and Intrado Inc. are using GWT.
How advantageous is learning GWT?
Many Google projects, both internal and external, are based on GWT; therefore Google will need to sustain the technology as long as they need to keep improving the front-end.
Conclusion
In this article, we have extensively discussed how the project GWT Horizontal Panel Widget. We have discussed its constructors, methods, and implementation. GWT Horizontal Panel Widget is a part of form widgets that are used in many places while developing applications. and if you would like to learn more, check out our articles on