fr.emn.cursors
Class JCursor

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byfr.emn.cursors.JCursor
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
JAWTCursor, JGestureCommand, JQuikWriting, JToolglass

public class JCursor
extends javax.swing.JComponent

This class provides all the functionalities to display and move an additional cursor on a JFrame. This component displays itself on the JLayeredPane of the JFrame. It takes the whole window space, but only repaints the cursor area.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.awt.Point ACTIVE_ARROW0
           
static java.awt.Point ACTIVE_ARROW1
           
static java.awt.Point ACTIVE_ARROW2
           
static java.awt.Point ACTIVE_ARROW3
           
static java.awt.Point ACTIVE_ERASER0
           
static java.awt.Point ACTIVE_ERASER1
           
static java.awt.Point ACTIVE_LINE0
           
static java.awt.Point ACTIVE_LINE1
           
static java.awt.Point ACTIVE_PENCIL0
           
static java.awt.Point ACTIVE_PENCIL1
           
static java.awt.Point ACTIVE_RECTANGLE0
           
static java.awt.Point ACTIVE_RECTANGLE1
           
static javax.swing.ImageIcon defaultIcon
           
protected  javax.swing.JFrame frame
           
static javax.swing.ImageIcon IMG_ARROW0
           
static javax.swing.ImageIcon IMG_ARROW1
           
static javax.swing.ImageIcon IMG_ARROW2
           
static javax.swing.ImageIcon IMG_ARROW3
           
static javax.swing.ImageIcon IMG_ERASER0
           
static javax.swing.ImageIcon IMG_ERASER1
           
static javax.swing.ImageIcon IMG_LINE0
           
static javax.swing.ImageIcon IMG_LINE1
           
static javax.swing.ImageIcon IMG_PENCIL0
           
static javax.swing.ImageIcon IMG_PENCIL1
           
static javax.swing.ImageIcon IMG_RECTANGLE0
           
static javax.swing.ImageIcon IMG_RECTANGLE1
           
static int LAYER0_COMPONENT
           
static int LAYER1
           
static int LAYER10_CURSOR
           
static int LAYER11
           
static int LAYER12
           
static int LAYER2_TOOLBAR
           
static int LAYER3
           
static int LAYER4_DIALOG
           
static int LAYER5
           
static int LAYER6_POPUP
           
static int LAYER7
           
static int LAYER8_DRAG
           
static int LAYER9
           
protected  javax.swing.Timer smoothTimer
           
protected  java.awt.event.ActionListener stopListener
           
protected  int xsmooth
           
protected  int ysmooth
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JCursor(javax.swing.ImageIcon image, java.awt.Point active)
           
 
Method Summary
protected static void addUsedLayer(javax.swing.JFrame f, int layer)
           
protected  void doRepaints()
          this can be useful for subclasses which display additional items (called automatically by setCursorLocation, before and after updating the cursor coordinates)
 void focusUnder()
           
 java.awt.Component getComponentUnder()
           
static java.awt.Component getComponentUnderLayer(javax.swing.JLayeredPane parent, int layer, int x, int y)
           
 javax.swing.JFrame getFrame()
           
 javax.swing.ImageIcon getImage()
           
 java.awt.Point getLocation()
           
 java.awt.Point getScreenLocation()
           
 void install(javax.swing.JFrame f)
           
 void install(javax.swing.JFrame f, int layer)
           
protected static boolean isLayerUsed(javax.swing.JFrame f, int layer)
           
 boolean isMoving()
           
static javax.swing.ImageIcon loadImage(java.lang.String filename)
          Loads an image either from the .jar file (class directory) or from the disk (execution directory)
 void moveSmoothlyTo(int xx, int yy)
           
 void moveSmoothlyTo(int xx, int yy, java.awt.event.ActionListener stoplistener)
           
 void paint(java.awt.Graphics g)
           
 void setAcceleration(float acc)
           
protected  void setCornerLocation(float xx, float yy)
          Every change on x and y must be done here.
 void setDirection(int ddx, int ddy)
           
 void setImage(javax.swing.ImageIcon image, java.awt.Point active)
           
 void setInterpolation(boolean a)
           
 void setLocalLocation(float xx, float yy)
           
 void setMaxRate(float max)
           
 void setMinRate(float min)
           
 void setOpacity(double o)
           
 void setScreenLocation(float xx, float yy)
           
 void setToCenter()
           
 void startMoving()
           
 void stopMoving()
           
 void uninstall()
           
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IMG_ARROW0

public static final javax.swing.ImageIcon IMG_ARROW0

IMG_ARROW1

public static final javax.swing.ImageIcon IMG_ARROW1

IMG_ARROW2

public static final javax.swing.ImageIcon IMG_ARROW2

IMG_ARROW3

public static final javax.swing.ImageIcon IMG_ARROW3

IMG_PENCIL0

public static final javax.swing.ImageIcon IMG_PENCIL0

IMG_PENCIL1

public static final javax.swing.ImageIcon IMG_PENCIL1

IMG_LINE0

public static final javax.swing.ImageIcon IMG_LINE0

IMG_LINE1

public static final javax.swing.ImageIcon IMG_LINE1

IMG_RECTANGLE0

public static final javax.swing.ImageIcon IMG_RECTANGLE0

IMG_RECTANGLE1

public static final javax.swing.ImageIcon IMG_RECTANGLE1

IMG_ERASER0

public static final javax.swing.ImageIcon IMG_ERASER0

IMG_ERASER1

public static final javax.swing.ImageIcon IMG_ERASER1

ACTIVE_ARROW0

public static final java.awt.Point ACTIVE_ARROW0

ACTIVE_ARROW1

public static final java.awt.Point ACTIVE_ARROW1

ACTIVE_ARROW2

public static final java.awt.Point ACTIVE_ARROW2

ACTIVE_ARROW3

public static final java.awt.Point ACTIVE_ARROW3

ACTIVE_PENCIL0

public static final java.awt.Point ACTIVE_PENCIL0

ACTIVE_PENCIL1

public static final java.awt.Point ACTIVE_PENCIL1

ACTIVE_LINE0

public static final java.awt.Point ACTIVE_LINE0

ACTIVE_LINE1

public static final java.awt.Point ACTIVE_LINE1

ACTIVE_RECTANGLE0

public static final java.awt.Point ACTIVE_RECTANGLE0

ACTIVE_RECTANGLE1

public static final java.awt.Point ACTIVE_RECTANGLE1

ACTIVE_ERASER0

public static final java.awt.Point ACTIVE_ERASER0

ACTIVE_ERASER1

public static final java.awt.Point ACTIVE_ERASER1

LAYER0_COMPONENT

public static final int LAYER0_COMPONENT

LAYER1

public static final int LAYER1

LAYER2_TOOLBAR

public static final int LAYER2_TOOLBAR

LAYER3

public static final int LAYER3

LAYER4_DIALOG

public static final int LAYER4_DIALOG

LAYER5

public static final int LAYER5

LAYER6_POPUP

public static final int LAYER6_POPUP

LAYER7

public static final int LAYER7

LAYER8_DRAG

public static final int LAYER8_DRAG

LAYER9

public static final int LAYER9

LAYER10_CURSOR

public static final int LAYER10_CURSOR

LAYER11

public static final int LAYER11

LAYER12

public static final int LAYER12

frame

protected javax.swing.JFrame frame

defaultIcon

public static javax.swing.ImageIcon defaultIcon

xsmooth

protected int xsmooth

ysmooth

protected int ysmooth

smoothTimer

protected javax.swing.Timer smoothTimer

stopListener

protected java.awt.event.ActionListener stopListener
Constructor Detail

JCursor

public JCursor(javax.swing.ImageIcon image,
               java.awt.Point active)
Method Detail

loadImage

public static javax.swing.ImageIcon loadImage(java.lang.String filename)
Loads an image either from the .jar file (class directory) or from the disk (execution directory)


doRepaints

protected void doRepaints()
this can be useful for subclasses which display additional items (called automatically by setCursorLocation, before and after updating the cursor coordinates)


focusUnder

public void focusUnder()

getComponentUnder

public java.awt.Component getComponentUnder()

getComponentUnderLayer

public static java.awt.Component getComponentUnderLayer(javax.swing.JLayeredPane parent,
                                                        int layer,
                                                        int x,
                                                        int y)

getFrame

public javax.swing.JFrame getFrame()

getLocation

public java.awt.Point getLocation()

install

public void install(javax.swing.JFrame f)

install

public void install(javax.swing.JFrame f,
                    int layer)

isLayerUsed

protected static boolean isLayerUsed(javax.swing.JFrame f,
                                     int layer)

addUsedLayer

protected static void addUsedLayer(javax.swing.JFrame f,
                                   int layer)

isMoving

public boolean isMoving()

moveSmoothlyTo

public void moveSmoothlyTo(int xx,
                           int yy)

moveSmoothlyTo

public void moveSmoothlyTo(int xx,
                           int yy,
                           java.awt.event.ActionListener stoplistener)

paint

public void paint(java.awt.Graphics g)

setInterpolation

public void setInterpolation(boolean a)

setAcceleration

public void setAcceleration(float acc)

setCornerLocation

protected void setCornerLocation(float xx,
                                 float yy)
Every change on x and y must be done here.


setDirection

public void setDirection(int ddx,
                         int ddy)

getImage

public javax.swing.ImageIcon getImage()

setImage

public void setImage(javax.swing.ImageIcon image,
                     java.awt.Point active)

setLocalLocation

public void setLocalLocation(float xx,
                             float yy)

setMaxRate

public void setMaxRate(float max)

setMinRate

public void setMinRate(float min)

getScreenLocation

public java.awt.Point getScreenLocation()

setScreenLocation

public void setScreenLocation(float xx,
                              float yy)

setToCenter

public void setToCenter()

startMoving

public void startMoving()

stopMoving

public void stopMoving()

uninstall

public void uninstall()

setOpacity

public void setOpacity(double o)