|
|||||||||||
| 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
beowulf.gui.DraggableContainer
This class extends the functionality of a basic JComponent so that when
other swing components are added to this container, they can be dragged
around according to how the user wants them positioned. The only real
code in this class simply assures that all components added to this
draggable container are instances of DraggableComponent (which can wrap
any swing component), and to handle some of the default behaviors of the
mouse to allow for dragging. The DraggableContainer also keeps track of
the currently selected component.
| Nested Class Summary |
| 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 DraggableComponent |
currentComponent
The currently selected component. |
protected EventListenerList |
listenerList
This list contains references to all interested listeners. |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, 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 | |
DraggableContainer()
The default (and only) constructor for a DraggableContainer. |
|
| Method Summary | |
Component |
add(Component comp)
Overridden version of the add method to ensure that the incoming component is an instance of DraggableComponent. |
Component |
add(Component comp,
int index)
Overridden version of the add method to ensure that the incoming component is an instance of DraggableComponent. |
void |
add(Component comp,
Object constraints)
Overridden version of the add method to ensure that the incoming component is an instance of DraggableComponent. |
void |
add(Component comp,
Object constraints,
int index)
Overridden version of the add method to ensure that the incoming component is an instance of DraggableComponent. |
Component |
add(String name,
Component comp)
Overridden version of the add method to ensure that the incoming component is an instance of DraggableComponent. |
void |
addDraggableComponentSelectionListener(DraggableComponentSelectionListener l)
This method adds a DraggableComponentSelectionListener as an interested listener of events to this DraggableContainer. |
protected void |
fireComponentDeselected(DraggableComponent component)
This method must be called by all subclasses after a component is deselected. |
protected void |
fireComponentSelected(DraggableComponent component)
This method must be called any time a component is selected. |
DraggableComponent |
getCurrentComponent()
Returns the currently selected component. |
void |
mouseClicked(MouseEvent me)
Part of the default highlighting/selecting handling. |
void |
mouseEntered(MouseEvent me)
Part of the default highlighting/selecting handling. |
void |
mouseExited(MouseEvent me)
Part of the default highlighting/selecting handling. |
void |
mousePressed(MouseEvent me)
Part of the default highlighting/selecting handling. |
void |
mouseReleased(MouseEvent me)
Part of the default highlighting/selecting handling. |
void |
removeDraggableComponentSelectionListener(DraggableComponentSelectionListener l)
This method removes the DraggableComponentSelectionListener as an interested listener of events to this DraggableContainer. |
void |
setCurrentComponent(DraggableComponent dc)
Sets the currently selected component. |
void |
setLayout(LayoutManager lm)
Overridden setLayout method to force a null layout for any instance of DraggableComponent. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected DraggableComponent currentComponent
protected EventListenerList listenerList
| Constructor Detail |
public DraggableContainer()
| Method Detail |
public DraggableComponent getCurrentComponent()
public void setCurrentComponent(DraggableComponent dc)
dc - The new currently selected component.public void addDraggableComponentSelectionListener(DraggableComponentSelectionListener l)
l - The draggable component selection listener to add.public void removeDraggableComponentSelectionListener(DraggableComponentSelectionListener l)
l - The draggable component selection listener to remove.protected void fireComponentSelected(DraggableComponent component)
component - The component that was selected.protected void fireComponentDeselected(DraggableComponent component)
component - The component that was deselected.public void mouseEntered(MouseEvent me)
mouseEntered in interface MouseListenerme - The mouse event that supplies extra parameters.public void mouseExited(MouseEvent me)
mouseExited in interface MouseListenerme - The mouse event that supplies extra parameters.public void mousePressed(MouseEvent me)
mousePressed in interface MouseListenerme - The mouse event that supplies extra parameters.public void mouseReleased(MouseEvent me)
mouseReleased in interface MouseListenerme - The mouse event that supplies extra parameters.public void mouseClicked(MouseEvent me)
mouseClicked in interface MouseListenerme - The mouse event that supplies extra parameters.public final void setLayout(LayoutManager lm)
lm - The new layout manager (no effect).public Component add(Component comp)
comp - The component to be added - must be a DraggableComponent.
public Component add(String name,
Component comp)
comp - The component to be added - must be a DraggableComponent.
public Component add(Component comp,
int index)
comp - The component to be added - must be a DraggableComponent.
public void add(Component comp,
Object constraints)
comp - The component to be added - must be a DraggableComponent.
public void add(Component comp,
Object constraints,
int index)
comp - The component to be added - must be a DraggableComponent.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||