Package com.ms.fx Previous
Previous
Contents
Contents
Index
Index
Next
Next

Advantages of com.ms.fx

How The Com.ms.fx Package Differs From Other Graphics Packages , An Example Using An FxPen Instead Of A Color , Callback Methods In This Documentation


How The Com.ms.fx Package Differs From Other Graphics Packages

The Microsoft FxGraphics package for Java is more powerful and flexible than standard graphics packages because it uses extensible objects.

The Microsoft Fx package for Java allows you to select Color and Font objects into a graphics context as you normally would. In this way it is fully .awt compatible, but the package is not limited to only system-defined standards. The flexibility of the extended objects may be demonstrated by first creating a Color, and then from that Color, defining a Fill, and from the Fill, a Pen. An FxPen (or an FxTexture, FxBrushPen, and so on) is selected into a graphics object the same way a Color is selected, and the application calls on the graphics object to perform its standard operations.


An Example Using An FxPen Instead Of A Color



The following example shows how a Color object is currently selected into a graphics context.

		g = getGraphics();
	
		g.setColor(Color.orange);
		g.drawLine(10, 10, 100, 100);
		// Draws a line from point (10,10) to point (100,100) with an orange pen that is 1 pixel wide.

 				
The Fx package allows you to select an FxPen object into an extended graphics context the same way that a Color is selected.

		g = FxGraphics.getExtendedGraphics(Graphics gOrig);
		// An extended graphics object.

		fxp = new FxPen(10, 255, 0, 0);
		// or fxp = new FxPen(10, Color.red);		
		// A red pen that is 10 pixels wide.


		g = setColor(fxp);
		g.drawLine(10, 10, 100, 100);
		// Draws a line from point (10,10) to point (100,100) with a red pen that is 10 pixels wide.
  				
		g.drawOval(10, 10, 100, 50);
		// Draws an oval with a bounding rectangle that is 100 pixels across, 50 pixels high, and starts at point (10,10).

	




Callback Methods In This Documentation

The Java application must only work with standard Java .awt and enough information for the selected Fx object. The application should use FxPen objects as it would Colors, or FxFont objects as it would Font objects.

All the callback (fillArcCallback, drawLineCallback) methods included in the Microsoft com.ms.fx package for Java are used only by the graphics object, not the application. The FxGraphics object does all the work!

The documentation of these callback methods is included for Java developers who want to extend these special FxGraphics objects. The classes that are affected are as follows:

FxFont A class that extends Font and manages user-defined font objects.
FxOutlineFont A class that extends FxFont and manages character outline font objects.
FxFill A class that extends FxColor and manages fill objects.
FxTexture A class that extends FxFill and provides color and texture.
FxPen A class that extends FxFill and provides a drawing pen object.
FxBrushPen A class that extends FxFill(FxPen) and manages an object that switches between pen and brush.
FxRubberPen A class that extends FxPen and manages a drag-event drawing pen.



Extended Color and Font Class (fx package) Hierarchies

Extended graphics classes in the com.ms.fx graphics package are in the following hierarchical structure.



			  Color								
			    +
			    I
			    +	
                         FxColor		       Font 
			    +				I	
			    I				+--FxFont
			    +				     I
     		    +---+ FxFill +---+		             +--FxOutlineFont
		    +	    +         +		             I			
		    I	    I	      I		   	     +--FxSystemFont(no callback methods)
		    +	    +         +
	      FxTexture   FxPen    FxBrushPen
			    +
			    I
			    +
			  FxRubberPen






Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.