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

Method paintFocus

CodenameOne/src/com/codename1/ui/List.java:1416–1442  ·  view source on GitHub ↗
(Graphics g, int width, Rectangle pos, Dimension rendererSize)

Source from the content-addressed store, hash-verified

1414 }
1415
1416 private void paintFocus(Graphics g, int width, Rectangle pos, Dimension rendererSize) {
1417 if (ignoreFocusComponentWhenUnfocused && !hasFocus()) {
1418 return;
1419 }
1420 if (!shouldRenderSelection()) {
1421 return;
1422 }
1423 calculateComponentPosition(getCurrentSelected(), width, pos, rendererSize, getElementSize(true, true), true);
1424 Dimension size = pos.getSize();
1425
1426 Component cmp = renderer.getListFocusComponent(this);
1427 if (cmp != null) {
1428 cmp.setCellRenderer(true);
1429 int x = pos.getX();
1430 int y = pos.getY();
1431
1432 // prevent focus animation from working during a drag operation
1433 if (orientation != HORIZONTAL) {
1434 y -= (animationPosition + fixedDraggedAnimationPosition);
1435 } else {
1436 x -= (animationPosition + fixedDraggedAnimationPosition);
1437 }
1438 renderComponentBackground(g, cmp, x, y, size.getWidth(), size.getHeight());
1439 renderComponent(g, cmp, x, y, size.getWidth(), size.getHeight());
1440 }
1441
1442 }
1443
1444 /// Renders the current component on the screen
1445 private void renderComponent(Graphics g, Component cmp, int x, int y, int width, int height) {

Callers 1

paintMethod · 0.95

Calls 14

shouldRenderSelectionMethod · 0.95
getCurrentSelectedMethod · 0.95
getElementSizeMethod · 0.95
setCellRendererMethod · 0.95
getWidthMethod · 0.95
getHeightMethod · 0.95
renderComponentMethod · 0.95
hasFocusMethod · 0.80
getSizeMethod · 0.65
getListFocusComponentMethod · 0.65

Tested by

no test coverage detected