Panel Class in Java AWT

0
98
Spread the love
  • 23
  • 34
  • 14
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    118
    Shares

Panel Class in Java AWT

Panel class is a Container that is contained within a container. Unlike Frame and Dialog, Panel is a container that does not create a separate window of its own. The panel is suitable for holding portions of a larger interface within a parent Frame or Dialog or within another Panel.

Note that Applet is a subclass of Panel, and thus applets are displayed in a Panel that is contained within a Web browser or applet viewer.

The default Layout Manager for a Panel is FlowLayout.The Panel class provides a generic Container within an existing display area.

The structure of the Panel class is given as

public class java.awt.Panel extends java.awt.Container{
// Public Constructors
public Panel();
public Panel (LayoutManager layout);
// Public Instance Methods
public void addNotify ();// Overrides Container
}

The details of the class structure are given as follows:

public Panel();

public Panel() constructs a Panel object.

public Panel(LayoutManager layout);

public Panel(LayoutManager layout) constructs a Panel object with the specified layout manager.

Parameter
layout – the layout to set for the panel

public void addNotify();

public void addNotify() method creates Panel’s peer and peers of contained components.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 23
  • 34
  • 14
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    118
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here