MCPcopy Index your code
hub / github.com/arduino/Arduino / refreshMenu

Method refreshMenu

app/src/processing/app/tools/MenuScroller.java:464–501  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

462 }
463
464 private void refreshMenu() {
465 if (menuItems != null && menuItems.length > 0) {
466 firstIndex = Math.max(topFixedCount, firstIndex);
467 firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex);
468
469 if (firstIndex < 0) {
470 return;
471 }
472
473 upItem.setEnabled(firstIndex > topFixedCount);
474 downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
475
476 menu.removeAll();
477 for (int i = 0; i < topFixedCount; i++) {
478 menu.add(menuItems[i]);
479 }
480 if (topFixedCount > 0) {
481 menu.addSeparator();
482 }
483
484 menu.add(upItem);
485 for (int i = firstIndex; i < scrollCount + firstIndex; i++) {
486 menu.add(menuItems[i]);
487 }
488 menu.add(downItem);
489
490 if (bottomFixedCount > 0) {
491 menu.addSeparator();
492 }
493 for (int i = menuItems.length - bottomFixedCount; i < menuItems.length; i++) {
494 menu.add(menuItems[i]);
495 }
496
497 JComponent parent = (JComponent) upItem.getParent();
498 parent.revalidate();
499 parent.repaint();
500 }
501 }
502
503 private int getMaximumDrawableMenuItems() {
504 JMenuItem test = new JMenuItem("test");

Callers 3

mouseWheelMovedMethod · 0.80
setMenuItemsMethod · 0.80
actionPerformedMethod · 0.80

Calls 5

minMethod · 0.80
getParentMethod · 0.80
maxMethod · 0.45
setEnabledMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected