FileDocCategorySizeDatePackage
CursorFactory.javaAPI DocAndroid 1.5 API2960Wed May 06 22:41:54 BST 2009org.apache.harmony.awt.wtk

CursorFactory

public abstract class CursorFactory extends Object
Provides factory for NativeCursor

Fields Summary
protected NativeCursor[]
systemCursors
Constructors Summary
Methods Summary
public abstract NativeCursorcreateCursor(int type)
Creates and returns NativeCursor for predefined Java Cursor

param
type - type of predefined Java Cursor
return
created cursor

public abstract NativeCursorcreateCustomCursor(java.awt.Image img, int xHotSpot, int yHotSpot)
Creates and returns custom NativeCursor from image

param
img - image(source) to create cursor from
param
xHotSpot - x coordinate of the hotspot relative to the source's origin
param
yHotSpot - y coordinate of the hotspot relative to the source's origin
return
created cursor

public abstract java.awt.DimensiongetBestCursorSize(int prefWidth, int prefHeight)
Query native system for the best cursor size closest to specified dimensions

param
prefWidth - preferred width
param
prefHeight - preferred height
return
closest supported dimensions to ones specified

public NativeCursorgetCursor(int type)
Gets a cached instance of system(predefined) native cursor or creates a new one. This is a platform-independent method.

param
type - type of predefined Java Cursor
return
created cursor

                            
        

                                      
        
        if (type >= 0 && type < systemCursors.length) {
            NativeCursor cursor = systemCursors[type];
            if (cursor == null) {
                cursor = createCursor(type);
                systemCursors[type] = cursor;
            }
            return cursor;
        }
        return null;
    
public abstract intgetMaximumCursorColors()

return
maximum number of colors supported by custom cursors