TextArea Class Diagram

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ancestor class specifications:

java.lang.Object
java.awt.Component
java.awt.TextComponent

TextArea Class Specification

            Invariant

                        A TextArea object...

-       is drawn as a rectangular region.

-       should be added to a container object with its upper-left corner x pixels from the left and y pixels from the top. (The upper left corner of the container is (0, 0).)

-       when it is contained within a proper GUI container the rectangle appears with  dimensions of the rectangle given by width and height.

-       if necessary, the rectangle image is clipped to the boundaries of its GUI container.

-       the content text is displayed within this rectangular region.  Lines can be separated by including end-of-line (Ò\nÓ) characters.  (Scrollbars are displayed within the text area if needed.)

 

Constructor Methods

public TextArea( )

post: A new TextArea object is created

         and   x  == 0   and   y == 0  and   width == 0   and   height == 0

         and   content  == ""

         (Note that TextAreas don't appear until added.)

 

            Update Methods

public void append( String s )

post:  content == content@pre concatenated_to s

 

public void repaint( )

post:  Causes the Java virtual machine to update the display of this object as soon as possible.

 

public void setBounds( int intX,  int initY, int w, int h )

post: x == initX   and   y == initY  and   width == w   and   height == h

 

public void setLocation( int intX,  int initY )

post: x == initX   and   y == initY

 

public void setSize( int w,  int h )

post: width == w   and   height == h

 

public void setText( String s )

post:  content == s

 

 

            Query Methods

public int getX( )

post: result == x

 

public int getY( )

post: result == y 

 

public int getWidth( )

post: result == width 

 

public int getHeight( )

post: result == height 

 

public java.awt.Container getParent( )

post: this Rectangle is added to a Container

                  implies result == the Container to which this is added

         and  this Rectangle is not added implies result == null

 

publicString getText( )

post:  result == content