AWT Containers-AWT Panel Class AWT (Abstract Window Toolkit)

What is the use of AWT Panel Class?


Class Panel is the simplest container class and it offers a space in which an application can attach any other component, including other panels. It uses FlowLayout as default layout manager.

Class declaration

Below is the declaration for java.awt.Panel class:

Class constructors


Constructor & Description



Creates a new panel using the default layout manager.


Panel(LayoutManager layout)

Creates a new panel with the specified layout manager.

Class methods


Method & Description


void addNotify()

Creates the Panel's peer.


AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this Panel.

Methods inherited

This class inherits methods from the following classes:

  • java.awt.Container
  • java.awt.Component
  • java.lang.Object

Panel Example

Create the following java program using any editor of your choice in say D:/ > AWT > com > wisdomjobs > gui >

Compile the program using command prompt. Go to D:/ > AWT and type the following command.

If no error comes that means compilation is successful. Run the program using following command.

Verify the following output


Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

AWT (Abstract Window Toolkit) Topics