|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
beowulf.gui.DraggableComponent
This class is just a wrapper class for any sort of swing component that is
to be inserted into a DraggableContainer. The reason one would do this, is
that any components inserted into a DraggableContainer must be wrapped in an
instance of this class. This class takes care of all of the highlighting
stuff via a mouse listener. If a swing component which is not a
DraggableComponent is added to an instance of a DraggableContainer, the
container will detect this and not add the component.
| Nested Class Summary |
| Nested classes inherited from class javax.swing.JLabel |
JLabel.AccessibleJLabel |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
protected JComponent |
c
The component being wrapped. |
protected DraggableContainer |
container
The container to which this Drag. |
protected boolean |
dragging
Flag for whether or not this Drag. |
protected boolean |
hovering
Flag for whether or not this Drag. |
protected int |
oldX
The old x value - used for dragging. |
protected int |
oldY
The old y value - used for dragging. |
| Fields inherited from class javax.swing.JLabel |
labelFor |
| 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 javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
DraggableComponent(DraggableContainer container,
JComponent c)
This is the basic constructor for a draggable component. |
|
DraggableComponent(DraggableContainer newContainer,
JComponent newC,
int x,
int y)
This is the full constructor for a draggable component. |
|
| Method Summary | |
JComponent |
getComponent()
Returns the contained swing component. |
DraggableContainer |
getDraggableContainer()
Returns the DraggableContainer this DraggableComponent is linked to. |
boolean |
getDragging()
Returns whether or not the component is being dragged. |
boolean |
getHovering()
Returns whether or not the mouse pointer is hover on the component. |
boolean |
getSelected()
Returns whether or not this component is the selected one. |
void |
mouseClicked(MouseEvent me)
This method is here as part of the highlight handling. |
void |
mouseDragged(MouseEvent me)
This method is here as part of the highlight handling. |
void |
mouseEntered(MouseEvent me)
This method is here as part of the highlight handling. |
void |
mouseExited(MouseEvent me)
This method is here as part of the highlight handling. |
void |
mouseMoved(MouseEvent me)
This method is here as part of the highlight handling. |
void |
mousePressed(MouseEvent me)
This method is here as part of the highlight handling. |
void |
mouseReleased(MouseEvent me)
This method is here as part of the highlight handling. |
void |
paintComponent(Graphics g)
This method tells the draggable component how to paint itself. |
void |
setDraggableContainer(DraggableContainer newContainer)
Sets the DraggableContainer this DraggableComponent is linked to. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected JComponent c
protected DraggableContainer container
protected boolean dragging
protected boolean hovering
protected int oldX
protected int oldY
| Constructor Detail |
public DraggableComponent(DraggableContainer container,
JComponent c)
container - The container that will hold this component.c - The swing component being wrapped by this draggable component.
public DraggableComponent(DraggableContainer newContainer,
JComponent newC,
int x,
int y)
newContainer - The container that will hold this component.newC - The swing component being wrapped by this draggable component.x - The initial x location of the component inside the container.y - The initial y location of the component inside the container.| Method Detail |
public JComponent getComponent()
public boolean getDragging()
public boolean getHovering()
public boolean getSelected()
public DraggableContainer getDraggableContainer()
public void setDraggableContainer(DraggableContainer newContainer)
newContainer - The DraggableContainer this DraggableComponent is linked to.public void mouseEntered(MouseEvent me)
mouseEntered in interface MouseListenerme - The mouse event supplying extra parameters.public void mouseExited(MouseEvent me)
mouseExited in interface MouseListenerme - The mouse event supplying extra parameters.public void mousePressed(MouseEvent me)
mousePressed in interface MouseListenerme - The mouse event supplying extra parameters.public void mouseReleased(MouseEvent me)
mouseReleased in interface MouseListenerme - The mouse event supplying extra parameters.public void mouseClicked(MouseEvent me)
mouseClicked in interface MouseListenerme - The mouse event supplying extra parameters.public void mouseDragged(MouseEvent me)
mouseDragged in interface MouseMotionListenerme - The mouse event supplying extra parameters.public void mouseMoved(MouseEvent me)
mouseMoved in interface MouseMotionListenerme - The mouse event supplying extra parameters.public void paintComponent(Graphics g)
g - The graphics context on which the component should draw itself.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||