public class Draggable_Rows extends JLayeredPane
A Draggable_Rows_Layout is used to maintain the display of the components as a single column of rows. All components, regardless of the layer they have been assigned to, are displayed in top-to-bottom order. Any components may be used as row components. These components may have their own functionality, including subcomponents.
A MouseInputListener is attached to the base pane and to each row
component and any subcomponents it might have. Whenever a mouse
button is pressed in the pane the row component that it falls within
is designated the selected row
and any registered list
selection listeners
are notified. If the shift key modifier is also
used then the selected row may be dragged vertically to a new row
position. Any registered row move listeners
are notified whenever the position
of a row changes.
JLayeredPane
,
Serialized FormModifier and Type | Class and Description |
---|---|
class |
Draggable_Rows.Draggable_Rows_Layout
Draggable_Rows_Layout is a LayoutManager for a vertical stack of
row Components.
|
class |
Draggable_Rows.Row_Moved_Event
A Row_Moved_Event carries the information that a component
row has moved from one position to another in the pane.
|
JLayeredPane.AccessibleJLayeredPane
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
static String |
ID
Class name and version identification.
|
Draggable_Rows.Draggable_Rows_Layout |
Layout_Manager |
Component |
Selected_Row |
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Draggable_Rows()
Constructs an empty Draggable_Rows pane.
|
Draggable_Rows(Vector rows)
Constructs a Draggable_Rows pane containing a list of row components.
|
Modifier and Type | Method and Description |
---|---|
Draggable_Rows |
Add_Row_Moved_Listener(ChangeListener listener)
Adds a row moved listener.
|
Draggable_Rows |
Add_Selection_Listener(ListSelectionListener listener)
Adds a list selection listener.
|
protected void |
addImpl(Component component,
Object constraints,
int index)
Adds a component to the pane.
|
boolean |
Remove_Row_Moved_Listener(ChangeListener listener)
Removes a row moved listener.
|
boolean |
Remove_Selection_Listener(ChangeListener listener)
Removes a list selection listener.
|
void |
remove(int index)
Removes an indexed row component from the pane.
|
static Point |
Screen_Point(MouseEvent event)
Gets the location of a mouse event relative to the coordinates of
the display screen.
|
Component |
Selected_Row()
Gets the currently selected row component.
|
Draggable_Rows |
Selected_Row(Component component)
Sets the currently selected row component.
|
Point |
this_Point(MouseEvent event)
Gets the location of a mouse event relative to the coordinates of
this pane.
|
getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, removeAll, setLayer, setLayer, setPosition
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final String ID
public Draggable_Rows.Draggable_Rows_Layout Layout_Manager
public Component Selected_Row
public Draggable_Rows(Vector rows)
The row components will be be displayed top-to-bottom in the order they occur in the list.
rows
- A Vector of Components to be added to the pane.public Draggable_Rows()
public Draggable_Rows Selected_Row(Component component)
If the specified component is a row component it is selected. Each
registered selection listener
is
notified of the change. The ListSelectionEvent sent to each listener
will contain this Draggable_Rows as the source and the index of the
selected component (for both first and last index). However, because
the index of a component might change, (@link #Selected_Row()} is the
best way to obtain the currently selected row component.
component
- The row component to be selected. If the component
is not a row component, or is null, nothing is done.public Component Selected_Row()
Selected_Row(Component)
public Draggable_Rows Add_Selection_Listener(ListSelectionListener listener)
Each registered listener is notified whenever the row selection changes.
listener
- A ListSelectionListener that will have its
valueChanged method called whenever the row selection changes. A
duplicate or null listener is not added.ListSelectionListener
public boolean Remove_Selection_Listener(ChangeListener listener)
listener
- The ListSelectionListener to be removed.Add_Selection_Listener(ListSelectionListener)
public Draggable_Rows Add_Row_Moved_Listener(ChangeListener listener)
Each registered listener is notified whenever a row position changes.
listener
- A ChangeListener that will have its
stateChanged method called whenever a row position changes. A
duplicate or null listener is not added.ChangeListener
public boolean Remove_Row_Moved_Listener(ChangeListener listener)
listener
- The ChangeListener to be removed.Add_Row_Moved_Listener(ChangeListener)
public void remove(int index)
Before the component is removed from the pane it, and any
subcomponents, has this pane's mouse event listener removed. If the
component being removed is the currently selected row, the selected row
is reset to null.
remove
in class JLayeredPane
index
- The index of the component to remove. An invalid
index is ignored.protected void addImpl(Component component, Object constraints, int index)
Before the component is added, this pane's mouse event listener is added to the component and any subcomponents it might have. The listener is not added if the component is already contained in this pane.
addImpl
in class JLayeredPane
component
- The Component to be added.constraints
- Layout contraints. This is expected to be
a layer number Integer.index
- The position in the container's list at which to
insert the component, where -1 means append to the end.public Point this_Point(MouseEvent event)
The event's location point is translated from the coordinates of the event's component to the coordinates of this pane.
event
- A MouseEvent.SwingUtilities.convertPoint(Component, Point, Component)
public static Point Screen_Point(MouseEvent event)
The event's location point is translated from the coordinates of the event's component to the coordinates of the display screen.
event
- A MouseEvent.SwingUtilities.convertPointToScreen(Point, Component)