fr.emn.cursors
Class JToolglass

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

public class JToolglass
extends JCursor

Title: Input Configurator Description: Copyright: Copyright (c) 2001 Company: Ecole des Mines de Nantes

Version:
1.0
Author:
Pierre Dragicevic
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
 
Fields inherited from class fr.emn.cursors.JCursor
ACTIVE_ARROW0, ACTIVE_ARROW1, ACTIVE_ARROW2, ACTIVE_ARROW3, ACTIVE_ERASER0, ACTIVE_ERASER1, ACTIVE_LINE0, ACTIVE_LINE1, ACTIVE_PENCIL0, ACTIVE_PENCIL1, ACTIVE_RECTANGLE0, ACTIVE_RECTANGLE1, defaultIcon, frame, IMG_ARROW0, IMG_ARROW1, IMG_ARROW2, IMG_ARROW3, IMG_ERASER0, IMG_ERASER1, IMG_LINE0, IMG_LINE1, IMG_PENCIL0, IMG_PENCIL1, IMG_RECTANGLE0, IMG_RECTANGLE1, LAYER0_COMPONENT, LAYER1, LAYER10_CURSOR, LAYER11, LAYER12, LAYER2_TOOLBAR, LAYER3, LAYER4_DIALOG, LAYER5, LAYER6_POPUP, LAYER7, LAYER8_DRAG, LAYER9, smoothTimer, stopListener, xsmooth, 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
JToolglass()
           
JToolglass(int columns, javax.swing.ImageIcon[] images)
           
 
Method Summary
 void addImage(javax.swing.ImageIcon image)
          Adds an image in the last empty cell.
 void addImages(javax.swing.ImageIcon[] images)
          Adds images in the last empty cells.
protected  javax.swing.ImageIcon createToolglassImage()
          Called to create a bitmap image of the toolglass.
 java.awt.Rectangle getCellBounds(int col, int row)
          Returns the cell bounds in local coordinates.
 int getToolIndex(java.awt.Point pscreen)
          Returns the tool given a point in screen coordinates. returns -1 if no tool is displayed at this point.
 void install(javax.swing.JFrame frame)
          Subclassed to create the tooglass image after the cursor has been installed.
 void removeImages()
           
 void setCellSize(java.awt.Dimension cellSize)
          If cellSize=null, cells are automatically dimensionned.
 void setColumns(int nb)
          Sets the number of columns.
 void setImage(int index, javax.swing.ImageIcon image)
          Sets the image in the given place (starting from 0, from left to right, then top to bottom).
 void setRows(int nb)
          Sets the number of lines.
 
Methods inherited from class fr.emn.cursors.JCursor
addUsedLayer, doRepaints, focusUnder, getComponentUnder, getComponentUnderLayer, getFrame, getImage, getLocation, getScreenLocation, install, isLayerUsed, isMoving, loadImage, moveSmoothlyTo, moveSmoothlyTo, paint, setAcceleration, setCornerLocation, setDirection, setImage, setInterpolation, setLocalLocation, setMaxRate, setMinRate, setOpacity, setScreenLocation, setToCenter, startMoving, stopMoving, 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
 

Constructor Detail

JToolglass

public JToolglass()

JToolglass

public JToolglass(int columns,
                  javax.swing.ImageIcon[] images)
Method Detail

setColumns

public void setColumns(int nb)
Sets the number of columns. Default value is 5, min value is 1.


setRows

public void setRows(int nb)
Sets the number of lines. Default value is 1, min value is 1. Number of lines may grow if the number of added images exceeds the toolglass size.


setImage

public void setImage(int index,
                     javax.swing.ImageIcon image)
Sets the image in the given place (starting from 0, from left to right, then top to bottom).


addImage

public void addImage(javax.swing.ImageIcon image)
Adds an image in the last empty cell.


addImages

public void addImages(javax.swing.ImageIcon[] images)
Adds images in the last empty cells.


removeImages

public void removeImages()

setCellSize

public void setCellSize(java.awt.Dimension cellSize)
If cellSize=null, cells are automatically dimensionned. This is the default behavior.

Minimum size is one pixel.


createToolglassImage

protected javax.swing.ImageIcon createToolglassImage()
Called to create a bitmap image of the toolglass. Component must be installed in order to retreive its graphics2D.


getCellBounds

public java.awt.Rectangle getCellBounds(int col,
                                        int row)
Returns the cell bounds in local coordinates. Col & row start from 0.


getToolIndex

public int getToolIndex(java.awt.Point pscreen)
Returns the tool given a point in screen coordinates. returns -1 if no tool is displayed at this point.


install

public void install(javax.swing.JFrame frame)
Subclassed to create the tooglass image after the cursor has been installed.

Overrides:
install in class JCursor