Module java.desktop
Package java.awt

Class Panel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
Applet

public class Panel
extends Container
implements Accessible
Panel is the simplest container class. A panel provides space in which an application can attach any other component, including other panels.

The default layout manager for a panel is the FlowLayout layout manager.

Since:
1.0
See Also:
FlowLayout, Serialized Form
  • Constructor Details

    • Panel

      public Panel()
      Creates a new panel using the default layout manager. The default layout manager for all panels is the FlowLayout class.
    • Panel

      public Panel​(LayoutManager layout)
      Creates a new panel with the specified layout manager.
      Parameters:
      layout - the layout manager for this panel.
      Since:
      1.1
  • Method Details

    • addNotify

      public void addNotify()
      Creates the Panel's peer. The peer allows you to modify the appearance of the panel without changing its functionality.
      Overrides:
      addNotify in class Container
      See Also:
      Component.isDisplayable(), Container.removeNotify()
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()
      Gets the AccessibleContext associated with this Panel. For panels, the AccessibleContext takes the form of an AccessibleAWTPanel. A new AccessibleAWTPanel instance is created if necessary.
      Specified by:
      getAccessibleContext in interface Accessible
      Overrides:
      getAccessibleContext in class Component
      Returns:
      an AccessibleAWTPanel that serves as the AccessibleContext of this Panel
      Since:
      1.3