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

What is the use of AWT Panel Class?

Introduction

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

S.N.

Constructor & Description

1

Panel()

Creates a new panel using the default layout manager.

2

Panel(LayoutManager layout)

Creates a new panel with the specified layout manager.

Class methods

S.N.

Method & Description

1

void addNotify()

Creates the Panel's peer.

2

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 >

AwtContainerDemo.java

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

awt_panel


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

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

AWT (Abstract Window Toolkit) Topics