|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Frame | +--javax.swing.JFrame | +--lava.gui.DragFrame
Supports drag and drop operations in a JFrame.
Details: DragFrame is an extended version of JFrame that provides easy-to-use graphical support for in-frame drag and drop operations.
DragSprite
, Serialized FormInner classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
Inner classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
Inner classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected java.awt.Point |
drag_origin
Drag origin. |
protected java.awt.Point |
drag_position
Current drag position. |
protected DragSprite |
sprite
Icon being dragged. |
Fields inherited from class javax.swing.JFrame |
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DragFrame()
Initializes a new DragFrame. |
Method Summary | |
void |
beginDrag(DragSprite sprite,
java.awt.event.MouseEvent origin)
Initiates a drag operation. |
void |
beginDrag(DragSprite sprite,
java.awt.Point origin)
Initiates a drag operation. |
void |
continueDrag(java.awt.event.MouseEvent e)
Updates the drag sprite position. |
void |
continueDrag(java.awt.Point p)
Updates the drag sprite position. |
void |
endDrag()
Terminates the dragging operation. |
java.awt.Dimension |
getDragAmount()
Computes drag offset. |
java.awt.Point |
getDragOrigin()
Returns drag origin. |
java.awt.Point |
getDragPosition()
Returns drag position. |
java.awt.Point |
getFramePoint(java.awt.event.MouseEvent e)
Computes the frame coordinates of the given MouseEvent. |
boolean |
isDragging()
Indicates whether drag is in progress. |
void |
paint(java.awt.Graphics g)
Repaints the frame. |
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Frame |
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle |
Methods inherited from class java.awt.Window |
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
protected DragSprite sprite
Details: sprite
is the icon being dragged, or is null if no drag operation is in progress.
protected java.awt.Point drag_origin
Details: drag_origin
is the Point
where the drag object originated from, in glass pane coordinates. If dragging is suspended, the drag sprite should be redrawn at this location.
This value is meaningless if no dragging is in progress.
protected java.awt.Point drag_position
Details: drag_position is the current Point of dragging, in frame coordinates. If the frame repaints during a drag, this is where the drag sprite should be drawn.
This value is meaningless if no dragging is in progress.
Constructor Detail |
public DragFrame()
Method Detail |
public void paint(java.awt.Graphics g)
Details: In addition to repainting the frame and all its children, paint also refreshes the drag sprite (on top of the frame and all its children) if a drag is in progress.
paint
in class java.awt.Container
g
- the graphics contextpublic void beginDrag(DragSprite sprite, java.awt.event.MouseEvent origin)
Details: Calling beginDrag
initializes a new drag operation using the supplied parameters. These parameters include a DragSprite
(sprite) and the first MouseEvent
associated with the dragging.
sprite
- the DragSprite (i.e., image to be dragged)origin
- the drag originpublic void beginDrag(DragSprite sprite, java.awt.Point origin)
Details: Calling beginDrag
initializes a new drag operation using the supplied parameters. These parameters include a DragSprite
(sprite) and the origin of the drag.
sprite
- the DragSprite (i.e., image to be dragged)origin
- the drag originpublic void continueDrag(java.awt.event.MouseEvent e)
Details: continueDrag updates the position of the drag sprite, repainting the old and new sprite regions so that icon appears correctly in the new location. The supplied MouseEvent (e) may be in any coordinate system, such as the coordinate system of the component from which the dragging originated. (This method will automatically translate the point.)
Dragging may be temporarily suspended by supplying a null
value for e
. When dragging is suspended, the dragged image snaps back to the drag origin. This behavior is useful for indicating illegal drag destinations.
e
- the MouseEvent associated with the new sprite positionpublic void continueDrag(java.awt.Point p)
Details: continueDrag updates the position of the drag sprite, repainting the old and new sprite regions so that icon appears correctly in the new location.
Dragging may be temporarily suspended by supplying a null
value for p
. When dragging is suspended, the drag image snaps back to the drag origin. This behavior is useful for indicating illegal drag destinations.
p
- the new drag coordinatepublic void endDrag()
Details: endDrag
terminates the dragging procedure by erasing the drag sprite.
public boolean isDragging()
Details: isDragging
returns true
if a drag is in progress, false
otherwise.
public java.awt.Point getDragOrigin()
Details: getDragOrigin
returns the point, in frame coordinates, where dragging last began.
public java.awt.Point getDragPosition()
Details: getDragPosition returns the point, in frame coordinates, of the last drag position.
public java.awt.Dimension getDragAmount()
Details: getDragAmount
computes the x and y offsets of the current drag position from the drag origin and returns it as a Dimension object.
public final java.awt.Point getFramePoint(java.awt.event.MouseEvent e)
e
- the MouseEvent
|
Sharkysoft home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |