MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / moveScrollTowards

Method moveScrollTowards

CodenameOne/src/com/codename1/ui/Form.java:4490–4518  ·  view source on GitHub ↗
(int direction, Component c)

Source from the content-addressed store, hash-verified

4488
4489 /// {@inheritDoc}
4490 @Override
4491 boolean moveScrollTowards(int direction, Component c) {
4492 //if the current focus item is in a scrollable Container
4493 //try and move it first
4494 Component current = getFocused();
4495 if (current != null) {
4496 Container parent;
4497 if (current instanceof Container) {
4498 parent = (Container) current;
4499 } else {
4500 parent = current.getParent();
4501 }
4502 while (parent != null) {
4503 if (parent == this) { //NOPMD CompareObjectsWithEquals
4504 if (getContentPane().isScrollable()) {
4505 getContentPane().moveScrollTowards(direction, c);
4506 }
4507
4508 } else {
4509 if (parent.isScrollable()) {
4510 return parent.moveScrollTowards(direction, c);
4511 }
4512 }
4513 parent = parent.getParent();
4514 }
4515 }
4516
4517 return true;
4518 }
4519
4520 /// Initiates a quick drag event on all containers of this form that have a negative scroll position.
4521 /// Sometimes, after editing, or on a screen-size change, scroll positions can get caught in a

Callers 2

updateFocusMethod · 0.95
keyPressedMethod · 0.45

Calls 6

getFocusedMethod · 0.95
getParentMethod · 0.95
getContentPaneMethod · 0.95
moveScrollTowardsMethod · 0.95
isScrollableMethod · 0.65
getParentMethod · 0.65

Tested by

no test coverage detected