DhPanel Class

DhPanel Class

This Package | All Packages

DhSection
  |
  +--DhPanel
public class DhPanel
extends DhSection

Represents a container for elements that uses tradition graphical user interface two-dimensional positioning for layout. Elements that are added into this kind of container are positioned in x-y coordinates as opposed to HTML one-dimentional flow layout. Elements can (and do) sit on top of each other in a z-order (or layered) manner. For a version of this container that is not based on x-y positioning, see DhSection.

Constructors
Name Description
DhPanel() Creates the DhPanel container.
DhPanel( Point size ) Creates the DhPanel container.
DhPanel( int width, int height ) Creates the DhPanel container.
DhPanel( Rectangle bounds ) Creates the DhPanel container.

Methods
Name Description
add(DhElement element, DhElement relativeTo, int insertFlag) Adds an element into this container in a specific place in the z-order.
getAllElements() Recursively returns all child elements and their children.
getElements() Retrieves the child elements of this element.

Constructors

DhPanel.DhPanel

Syntax 1
public DhPanel();
Description

Creates the DhPanel container.



Syntax 2
public DhPanel( Point size );
Parameters
size
The initial size of the container.
Description

Creates the DhPanel container. This constructor creates a panel container of a specified size based on a Point object.



Syntax 3
public DhPanel( int width, int height );
Parameters
width
The initial width of the container.
height
The initial height of the container.
Description

Creates the DhPanel container. This constructor creates a panel container of a specified size based on height and width.



Syntax 4
public DhPanel( Rectangle bounds );
Parameters
bounds
The initial location and size of the container.
Description

Creates the DhPanel container. This constructor creates a panel container of a specified size and location.

Methods

DhPanel.add

Syntax
public synchronized void add( DhElement element, DhElement relativeTo, int insertFlag );
Parameters
element
The DhElement to add to this container.
relativeTo
The DhElement referred to when using the INSERT_BEFORE or INSERT_AFTER constants for the insertFlag parameter.
insertFlag
One of the valid and applicable DhInsertEnum insert constants. The valid values for insertFlag are:
  • INSERT_END, element will be on top of all other elements in this panel. The relativeTo paramater must be null.
  • INSERT_BEGINNING, element will be behind all other elements in this panel. The relativeTo paramater must be null.
  • INSERT_BEFORE, element will be behind the relativeTo parameter. The relativeTo paramater must not be null.
  • INSERT_AFTER, element will be on top of the relativeTo parameter. The relativeTo paramater must not be null.
Description

Adds an element into this container in a specific place in the z-order. The order depends on the insertFlag parameter.

You can also call add and then move setZIndex.

Elements are added with a default size and position. Therefore, you should always call element.setBounds to perform a visual cleanup.

DhPanel.getAllElements

Syntax
public DhElement[] getAllElements();
Return Value

Returns an array of all child elements.

Description

Recursively returns all child elements and their children.

DhPanel.getElements

Syntax
public DhElement[] getElements();
Return Value

Returns an array of direct child elements.

Description

Retrieves the child elements of this element.