DhText Class

DhText Class

This Package | All Packages

DhStyleBase
  |
  +--DhElement
    |
    +--DhText
public class DhText
extends DhElement

Represents static text in an HTML document. This element is displayed in one of two modes: freely formatted (the default) or honor white space. The latter means that all white space (including carriage returns) is maintained.

Constructors
Name Description
DhText() Creates a DhText object.
DhText( String text ) Creates a DhText object.

Methods
Name Description
getRespectSpace() Determines if this element currently honors white space.
getText() Retrieves the text this element currently displays when rendered.
hasDefaultText() Determines if there is text in the object.
setRespectSpace(boolean f) Sets the text format either to honor white space or to be freely formatted.
setText( String s ) Sets (or resets) the text to display in this element.

Constructors

DhText.DhText

Syntax 1
public DhText();
Description

Creates a DhText object.



Syntax 2
public DhText( String text );
Parameters
text
The text to display.
Description

Creates a DhText object. For one-step construction, the text parameter is what is displayed in this element.

Methods

DhText.getRespectSpace

Syntax
public synchronized boolean getRespectSpace();
Return Value

Returns true if white space is honored; otherwise, returns false.

Description

Determines if this element currently honors white space.

See Also
setRespectSpace(boolean)

DhText.getText

Syntax
public synchronized String getText();
Return Value

Returns the text this element displays.

Description

Retrieves the text this element currently displays when rendered.

DhText.hasDefaultText

Syntax
public boolean hasDefaultText();
Return Value

Returns true if there is no text; otherwise, returns false.

Description

Determines if there is text in the object.

DhText.setRespectSpace

Syntax
public synchronized void setRespectSpace( boolean f );
Parameters
f
Set to true to honor white space; set to false (the default) to cause the text to be freely formatted.
Description

Sets the text format either to honor white space or to be freely formatted.

DhText.setText

Syntax
public synchronized void setText( String s );
Parameters
s
The text to display.
Description

Sets (or resets) the text to display in this element.