ComponentDropLocation (final GuiEditor editor, final ComponentDropLocation location, final ComponentDragObject dragObject, final KeyEvent e) { ComponentDropLocation.Direction dir = directionFromKey(e.getKeyCode()); boolean moveToLast = isMoveToLast(e.getKeyCode()); if (dir != null && location != null) { e.consume(); ComponentDropLocation adjacentLocation; if (moveToLast) { adjacentLocation = location.getAdjacentLocation(dir); ComponentDropLocation lastLocation = location; while(adjacentLocation != null) { if (adjacentLocation.canDrop(dragObject)) { lastLocation = adjacentLocation; } adjacentLocation = adjacentLocation.getAdjacentLocation(dir); } adjacentLocation = lastLocation; } else { adjacentLocation = location.getAdjacentLocation(dir); while(adjacentLocation != null && !adjacentLocation.canDrop(dragObject)) { adjacentLocation = adjacentLocation.getAdjacentLocation(dir); } } if (adjacentLocation != null && adjacentLocation.canDrop(dragObject)) { adjacentLocation.placeFeedback(editor.getActiveDecorationLayer(), dragObject); return adjacentLocation; } } return location; }