Package com.ms.fx |
![]() Previous |
![]() Contents |
![]() Index |
![]() Next |
public class FxPen extends FxFill { // Constructors public FxPen(); public FxPen(int width, int rgb); public FxPen(int width, int r, int g, int b); public FxPen(int width, Color c); // Methods public int getWidth(); public void setWidth(int w); public boolean drawLineCallback(FxGraphics g, int x1, int y1, int x2, int y2); public boolean drawPolygonCallback(FxGraphics g, int xPoints[], int yPoints[], int nPoints); public boolean fillRectCallback(FxGraphics g, int x, int y, int width, int height); public boolean drawRectCallback(FxGraphics g, int x, int y, int width, int height); public boolean drawRoundRectCallback(FxGraphics g, int x, int y, int width, int height, int arcWidth, int arcHeight); public boolean drawScanLinesCallback(FxGraphics g, boolean xChanging, int points[], int offset, int nPoints); public boolean drawOvalCallback(FxGraphics g, int x, int y, int w, int h); }
A wide pen. Be aware that the line drawing calculations are done here for lines. For other curves, however, the calculations are done in the ShapeX derived routines.
The Microsoft com.ms.fx Java package is more powerful and more flexible than other graphics packages because it uses extensible objects.
public FxPen();Create a wide pen with a default base color.
public FxPen(int width, int rgb);Creates a pen with the specified width and base color.
Parameter Description width The width of the pen. rgb The base color to use.
public FxPen(int width, int r, int g, int b);Creates a pen with the specified width and color settings.
Parameter Description width The width of the pen. r The amount of red. g The amount of green. b The amount of green.
public FxPen(int width, Color c);Creates a pen with a specified base color.
Parameter Description width The width of the pen. c The base color.
public int getWidth();Retrieves the width of the pen, in pixels.
Return Value:
Returns the width of the pen.
public void setWidth(int w);Sets the width of the pen.
Parameter Description w The width to set the pen to. Remarks:
The width of the pen may only be changed after the pen is created.
public boolean drawLineCallback(FxGraphics g, int x1, int y1, int x2, int y2);Draws a line using the pen.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. x1 The x coordinate of the starting point of the line. y1 The y coordinate of the starting point of the line. x2 The x coordinate of the ending point of the line. y2 The y coordinate of the ending point of the line. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean drawPolygonCallback(FxGraphics g, int xPoints[], int yPoints[], int nPoints);Draws a polygon using the pen.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. xPoints An array containing the polygon's x coordinates. yPoints An array containing the polygon's y coordinates. nPoints The number of points in the polygon. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean fillRectCallback(FxGraphics g, int x, int y, int width, int height);Draws a filled rectangle using the pen.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. x The x coordinate of the rectangle's upper left corner. y The y coordinate of the rectangle's upper left corner. width The width of the rectangle. height The height of the rectangle. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean drawRectCallback(FxGraphics g, int x, int y, int width, int height);Draws a rectangle using the pen, similar to fillRectCallback, above.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. x The x coordinate of the rectangle's upper left corner. y The y coordinate of the rectangle's upper left corner. width The width of the rectangle. height The height of the rectangle. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean drawRoundRectCallback(FxGraphics g, int x, int y, int width, int height, int arcWidth, int arcHeight);Draws a rectangle with rounded edges using the pen.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. x The x coordinate of the rectangle's upper left corner. y The y coordinate of the rectangle's upper left corner. width The width of the rectangle. height The height of the rectangle. arcWidth The arc width of the rectangle's rounded edges. arcHeight the arc height of the rectangle's rounded edges. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean drawScanLinesCallback(FxGraphics g, boolean xChanging, int points[], int offset, int nPoints);Draws fast lines, either horizontally or vertically.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. xChanging The direction the line should be drawn, either horizontally or vertically. points An array of points. offset The offset to use. nPoints The number of points in the array. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
public boolean drawOvalCallback(FxGraphics g, int x, int y, int w, int h);Draws an oval with the pen.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter Description g The graphics object to use. x The x coordinate of the upper left corner of the oval's bounding rectangle. y The y coordinate of the upper left corner of the oval's bounding rectangle. w The width of the oval's bounding rectangle. h The height of the oval's bounding rectangle. Remarks:
This method is used internally and is not intended to be called by applications. It is made public so that derived classes may extend the callback functionality.
© 1997 Microsoft Corporation. All rights reserved. Legal Notices.