new Color(redness, greenness, blueness); | Mix a new color. Parameter values are numbers between 0 and 255. |
new Location(x,y); | Build a coordinate pair object for the point (x,y). |
someColor.getRed() someColor.getGreen() someColor.getBlue() |
Access any of the color values associated with a Color. |
someLocation.getX() someLocation.getY() |
Access either of the elements of a coordinate pair. |
someLocation.distanceTo( anotherLocation )
|
Determine the distance between two points. |
new
FramedRect( x, y, width, height, canvas);
new
FramedRect( corner1Location, corner2Location, canvas);
new
FramedRect( cornerLocation, width, height, canvas);
|
The parameters to a rectangle or oval constructor describe
the rectangle bounding the object to be drawn. You can either:
You can fill these shapes or just frame their perimeters. |
new
Line( startX, startY, endX, endY, canvas);
new Line( startLocation, endLocation, canvas); |
A line is described by giving its end points. |
new Text( "some
message", x, y, canvas); new Text( "some message", baseLocation, canvas); |
The coordinates specify the leftmost point of the text's baseline. |
someObject.move( xOffset, yOffset); |
Move an object relative to its current position. |
someObject.moveTo( x, y);
someObject.moveTo( someLocation); |
Move an object to point specified by coordinates. |
someObject.contains( someLocation); |
Determine if an object's bounding box contains a point. |
someObject.hide(); someObject.show(); |
Make an object invisible or visible on the display. |
someObject.removeFromCanvas(); |
Delete object from its canvas. |
someObject.sendForward();
someObject.sendToFront(); someObject.sendBackward(); someObject.sendToBack(); |
Alter the stacking order that controls how overlapping objects appear. |
someObject.getColor();
someObject.setColor( someColor ); |
Access or change an object's color. |
someObject.getX(); |
Access coordinates of the upper left corner of an object's bounding rectangle. |
someObject.getWidth();
someObject.getHeight(); |
Access the dimensions of an object's bounding rectangle. |
someObject.setWidth( newWidth);
|
Change the dimensions of an object's bounding rectangle. |
someLine.setStart( someLocation );
|
Change either or both of a line's end points. |
someText.setText( "new message" );
|
Change the characters displayed. |
someText.setFontSize( pointSize );
|
Change the font size used. |
someText.setBold(); someText.setItalic(); someText.setPlain(); |
Change the style in which text is displayed. |
someText.setFont( someFont ) |
Change the font used. |