/** * Invoked when item selection changes. */ public void selectionChanged(ScrollablePopupMenuItem targetItem, boolean wasSelected) { Component[] comps = menuPanel.getComponents(); int n = comps.length; // Deselect all if something was selected if (!wasSelected) { for (int i = n - 1; i >= 0; i--) { ScrollablePopupMenuItem item = (ScrollablePopupMenuItem) comps[i]; item.setSelected(wasSelected); } } else { for (Component comp : comps) { ScrollablePopupMenuItem item = (ScrollablePopupMenuItem) comp; if (item == targetItem) { break; } item.setSelected(true); } } footer.setText(model.getFooterText() + getSelectedItemsCount()); repaint(); }
/** * Invoked when item selection changes. */ public void selectionChanged(ScrollablePopupMenuItem targetItem, boolean wasSelected) { Component[] comps = menuPanel.getComponents(); int n = comps.length; // Deselect all if something was selected if (!wasSelected) { for (int i = n - 1; i >= 0; i--) { ScrollablePopupMenuItem item = (ScrollablePopupMenuItem) comps[i]; item.setSelected(wasSelected); } } else { for (int i = 0; i < n; i++) { ScrollablePopupMenuItem item = (ScrollablePopupMenuItem) comps[i]; if (item == targetItem) { break; } item.setSelected(true); } } footer.setText(model.getFooterText() + getSelectedItemsCount()); repaint(); }
/** * Processes click on the pop up menu item. */ public void processItemClicked() { footer.setText(model.getFooterText() + 0); setVisible(false); model.processItemClicked(); }
/** * Sets the ScrollablePopupMenuModel. * * @param model * the model to set */ public void setModel(ScrollablePopupMenuModel model) { this.model = model; this.footer.setText(model.getFooterText()); }
/** * Processes click on the pop up menu item. */ public void processItemClicked() { footer.setText(model.getFooterText() + 0); setVisible(false); model.processItemClicked(); }
/** * Sets the ScrollablePopupMenuModel. * * @param model * the model to set */ public void setModel(ScrollablePopupMenuModel model) { this.model = model; this.footer.setText(model.getFooterText()); }