Table of contents
1.
Introduction
2.
Class Declaration
3.
Class Constructors
4.
Class Methods
5.
Inherited Methods
6.
Frequently Asked Questions
6.1.
What is GWT Servlet?
6.2.
What is the GWT Maven plugin?
6.3.
What is Smart GWT?
6.4.
Does Google support GWT?
6.5.
What are the advantages of GWT?
7.
Conclusion
Last Updated: Mar 27, 2024

GWT DeckPanel Widget

Author soham Medewar
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Google Web Toolkit (GWT) is a free and open-source Java software development framework that makes it simple to create AJAX applications. GWT allows you to create and debug AJAX applications in Java using the Java development tools of your choice. When you put your application into production, the GWT compiler converts it from Java to browser-compliant JavaScript and HTML.

gwt image

The DeckPanel widget is a panel that is used to display all of its child widgets in a 'deck,' with only one visible at a time. TabPanel makes use of it.

Class Declaration

The declaration for com.google.gwt.user.client.ui.DeckPanel is shown below.

public class DeckPanel
  extends ComplexPanel
      implements InsertPanel.ForIsWidget, HasAnimation
You can also try this code with Online Java Compiler
Run Code

Class Constructors

Sr. No. Constructor  Description
1. DeckPanel() This constructor creates an empty deck panel.

Class Methods

Sr. No. Function Description
1. add

Usage: public void add(Widget w)

The above method helps us to add the child widget to the Deck Panel widget. This method overrides the add method from the panel class. The w parameter that is passed into the method is the widget that is to be added to the Deck Panel.

2. getVisibleWidget Usage: public int getVisibleWidget()
This method helps us to return the index of the currently visible widget in the Deck Panel widget. It returns -1 if there isn’t any visible widget in the Deck Panel.
3. insert

Usage: public void insert(Widget w, int beforeIndex)

Inserts a new child widget before the index provided. The widget will be relocated to the provided index if it is already a child of this panel. Here the parameter w is the child widget that is to be inserted in the Deck Panel, and the beforeIndex parameter is the index before which the widget will be inserted.

4.  isAnimationEnabled

Usage: public boolean isAnimationEnabled()

This method returns a value true if the animation is enabled in the Deck Panel, or else it returns false.

5.  remove

Usage: public boolean remove(Widget w)

This method helps us to remove the widget from the Deck Panel. The parameter w is the widget that has to be removed from the panel. The remove method is overridden from the ComplexPanel class. This method returns true if the child was present in the Panel or else removes false.

6.  setAnimationEnabled

Usage: public void setAnimationEnabled(boolean enable)

This method is used to enable or disable animation in the Deck Panel. If the boolean value passed into the method is enable(true), then all the animations are enabled. If passed disable(false), then all the animations will be disabled.

7.  showWidget

Usage: public void showWidget(int index)

This method will help us to show the widget at the specified index. As a result of this, the presently displayed widget is hidden. The parameter index is the index of the widget shown.

Inherited Methods

The methods of this class are inherited from the following classes:

  • com.google.gwt.user.client.ui.Widget
  • com.google.gwt.user.client.ui.UIObject
  • com.google.gwt.user.client.ui.ComplexPanel
  • com.google.gwt.user.client.ui.Panel
  • java.lang.Object

Frequently Asked Questions

What is GWT Servlet?

GWT supports several methods for communicating with a server through HTTP. You may use the GWT RPC framework to perform transparent calls to Java servlets while GWT handles low-level complexities like object serialization. You may also utilize GWT's HTTP client classes to create and send custom HTTP requests.

What is the GWT Maven plugin?

By providing particular objectives, lifecycles, and artifact handlers, the Maven Plugin for GWT attempts to make it simpler to develop GWT applications with Maven. Java code in GWT is divided into two categories: Shared code and fully client-side code

What is Smart GWT?

Smart GWT is a GWT-based framework that combines its rich UI components with a Java Server Framework for developing high-quality online applications. Smart GWT has the most extensive and diverse set of UI components.

Does Google support GWT?

Many Google products, including Google AdWords and Google Wallet, employ GWT. It's open-source and fully free, and it's utilized by thousands of passionate developers all around the world.

What are the advantages of GWT?

If you are a seasoned Java programmer with knowledge of Swing or AWT, selecting GWT should be simple. With this foundation, the learning curve is the shortest. Even if you lack experience in Java GUI programming, the years spent working on server-side Java will be helpful when creating GWT applications.

Conclusion

In this article, we have learned about the GWT Deck Panel widget and its methods.

If you want to learn more, check out our articles on GWT UI BinderGWT TabPanel Widget, and GWT Composite Widget.

Do upvote our blogs if you find them helpful and engaging!

Happy Learning, Ninjas!

thank you image
Live masterclass