java.beans.EventHandler Java Examples

The following examples show how to use java.beans.EventHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OnePageWindow.java    From wpcleaner with Apache License 2.0 7 votes vote down vote up
/**
 * @return Tools menu.
 */
protected JMenu createToolsMenu() {
  JMenu menu = Utilities.createJMenu(GT._T("&Tools"));
  JMenuItem menuItem = null;
  menu.add(createFixRedirectsMenu());

  menuItem = Utilities.createJMenuItem(GT._T("&Preview"), false);
  menuItem.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionPreview"));
  menu.add(menuItem);

  menuItem = Utilities.createJMenuItem(GT._T("&Expand templates"), false);
  menuItem.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionExpandTemplates"));
  menu.add(menuItem);

  menuItem = Utilities.createJMenuItem(GT._T("Expand templates &and Preview"), false);
  menuItem.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionExpandTemplatesPreview"));
  menu.add(menuItem);
 
  return menu;
}
 
Example #2
Source File: GoToIntervalRenderer.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the button for the detection if it doesn't already exist.
 * 
 * @param value Detection.
 * @return Button for the detection.
 */
private JButton getButton(Object value) {
  if (buttons.containsKey(value)) {
    return buttons.get(value);
  }
  if (!(value instanceof Interval)) {
    return null;
  }
  Interval interval = (Interval) value;
  String actionCommand = Integer.toString(interval.getBeginIndex()) + ";" + Integer.toString(interval.getEndIndex());
  JButton button = new JButton(Utilities.getImageIcon(
      "gnome-edit-find.png",
      EnumImageSize.SMALL));
  button.setBorderPainted(false);
  button.setContentAreaFilled(false);
  button.setActionCommand(actionCommand);
  button.setEnabled(true);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "goTo", "actionCommand"));
  buttons.put(value, button);
  return button;
}
 
Example #3
Source File: PageCommentsWindow.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * @return Login components.
 */
private Component createCommandComponents() {
  JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
  panel.setBorder(BorderFactory.createEtchedBorder());

  // Ok button
  buttonOk = Utilities.createJButton(GT._T("&OK"), null);
  buttonOk.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionOk"));
  panel.add(buttonOk);

  // Validate button
  buttonRemove = Utilities.createJButton(GT._T("&Remove page comments"), null);
  buttonRemove.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionRemove"));
  panel.add(buttonRemove);

  // Cancel button
  buttonCancel = ActionDispose.createButton(getParentComponent(), true, true);
  panel.add(buttonCancel);

  return panel;
}
 
Example #4
Source File: DetectionRenderer.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the button for the detection if it doesn't already exist.
 * 
 * @param value Detection.
 * @return Button for the detection.
 */
private JButton getButton(Object value) {
  if (buttons.containsKey(value)) {
    return buttons.get(value);
  }
  if ((value == null) || !(value instanceof CheckWikiDetection)) {
    return null;
  }
  CheckWikiDetection detection = (CheckWikiDetection) value;
  JButton button = new JButton(Utilities.getImageIcon(
      "gnome-edit-find.png", EnumImageSize.SMALL));
  button.setBorderPainted(false);
  button.setContentAreaFilled(false);
  button.setActionCommand(Integer.toString(detection.getLocation()));
  button.setEnabled(textPane != null);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "goToDetection", "actionCommand"));
  buttons.put(value, button);
  return button;
}
 
Example #5
Source File: MainWindow.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Action called when Special Lists button is pressed.
 */
public void actionSpecialLists() {
  // Create menu for special lists
  JPopupMenu menu = new JPopupMenu();
  for (EnumQueryPage query : EnumQueryPage.values()) {
    JMenuItem item = new JMenuItem(query.getName());
    item.setActionCommand(query.getCode());
    item.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionSpecialList", "actionCommand"));
    menu.add(item);
  }
  menu.show(
      buttonSpecialLists,
      0,
      buttonSpecialLists.getHeight());
}
 
Example #6
Source File: LanguageSelectionPanel.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Action called when a Variant button is clicked.
 * 
 * @param number Variant number.
 */
public void actionVariant(String number) {
  JPopupMenu menu = new JPopupMenu();
  int variantNumber = Integer.parseInt(number);
  String prefix = language.getCode();
  if (script != null) {
    prefix += "-" + script.getCode();
  }
  if (region != null) {
    prefix += "-" + region.getCode();
  }
  for (int i = 0; i < variantNumber; i++) {
    if (variant.get(i) != null) {
      prefix += "-" + variant.get(i).getCode();
    }
  }
  List<LanguageRegistry.Variant> variants = registry.getVariants(prefix);
  for (LanguageRegistry.Variant tmpVariant : variants) {
    JMenuItem item = new JMenuItem(tmpVariant.toString());
    item.setActionCommand(number + ";" + tmpVariant.getCode());
    item.addActionListener(EventHandler.create(
        ActionListener.class, this, "selectVariant", "actionCommand"));
    menu.add(item);
  }
  menu.show(buttonVariant.get(variantNumber), 0, buttonVariant.get(variantNumber).getHeight());
}
 
Example #7
Source File: CopyCellRenderer.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the button for the detection if it doesn't already exist.
 * 
 * @param table Table.
 * @param row Row.
 * @return Button for the row.
 */
private JButton getButton(JTable table, int row) {
  Integer rowNum = Integer.valueOf(row);
  if (buttons.containsKey(rowNum)) {
    return buttons.get(rowNum);
  }
  JButton button = new JButton(Utilities.getImageIcon(
      "gnome-edit-copy.png", EnumImageSize.SMALL));
  button.setBorderPainted(false);
  button.setContentAreaFilled(false);
  Object value = table.getValueAt(row, copyColumn);
  button.setActionCommand(value != null ? value.toString() : "");
  button.setEnabled(true);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "copyCell", "actionCommand"));
  buttons.put(rowNum, button);
  return button;
}
 
Example #8
Source File: GoToExternalRenderer.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the button for the detection if it doesn't already exist.
 * 
 * @param value Detection.
 * @return Button for the detection.
 */
private JButton getButton(Object value) {
  if (buttons.containsKey(value)) {
    return buttons.get(value);
  }
  if (!(value instanceof String)) {
    return null;
  }
  String url = (String) value;
  JButton button = new JButton(Utilities.getImageIcon(
      "gnome-emblem-web.png",
      EnumImageSize.SMALL));
  button.setBorderPainted(false);
  button.setContentAreaFilled(false);
  button.setActionCommand(url);
  button.setEnabled(true);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "goTo", "actionCommand"));
  buttons.put(value, button);
  return button;
}
 
Example #9
Source File: UserNameSelector.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor.
 * 
 * @param parentComponent Parent component.
 */
public UserNameSelector(Component parentComponent) {
  this.parentComponent = parentComponent;
  this.changeListeners = new ArrayList<>();
  
  // Create combo box
  combo = new JComboBox<>();
  combo.setEditable(true);
  combo.addItemListener(EventHandler.create(
      ItemListener.class, this, "notifyUserNameChange"));

  // Create label
  label = Utilities.createJLabel(GT._T("Username:"));
  label.setLabelFor(combo);
  label.setHorizontalAlignment(SwingConstants.TRAILING);
}
 
Example #10
Source File: GoToRenderer.java    From wpcleaner with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the button for the detection if it doesn't already exist.
 * 
 * @param value Detection.
 * @return Button for the detection.
 */
private JButton getButton(Object value) {
  if (buttons.containsKey(value)) {
    return buttons.get(value);
  }
  String actionCommand = constructActionCommand(value);
  if (actionCommand == null) {
    return null;
  }
  JButton button = new JButton(Utilities.getImageIcon(
      (textPane != null) ? "gnome-edit-find.png" : "gnome-system-run.png",
      EnumImageSize.SMALL));
  button.setBorderPainted(false);
  button.setContentAreaFilled(false);
  button.setActionCommand(actionCommand);
  button.setEnabled(true);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "goTo", "actionCommand"));
  buttons.put(value, button);
  return button;
}
 
Example #11
Source File: Test6179222.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #12
Source File: ActionUpdateWarning.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Show menu for updating warnings.
 * 
 * @param e Event triggering this call.
 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
 */
@Override
public void actionPerformed(ActionEvent e) {
  if ((e == null) ||
      (e.getSource() == null) ||
      (!(e.getSource() instanceof Component))) {
    return;
  }
  Component source = (Component) e.getSource();

  // Display menu
  JPopupMenu menuWarning = new JPopupMenu();
  JMenuItem menuItem = Utilities.createJMenuItem(
      GT._T("Add a warning about links to disambiguation pages"),
      true);
  menuItem.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionDisambiguationWarning"));
  menuWarning.add(menuItem);

  menuItem = Utilities.createJMenuItem(
      GT._T("Add a warning about ISBN errors"),
      true);
  menuItem.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionISBNWarning"));
  menuWarning.add(menuItem);

  menuItem = Utilities.createJMenuItem(
      GT._T("Add a warning about duplicate arguments errors"),
      true);
  menuItem.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionDuplicateArgsWarning"));
  menuWarning.add(menuItem);

  menuWarning.show(source, 0, source.getHeight());
}
 
Example #13
Source File: Test6179222.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #14
Source File: Test6179222.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #15
Source File: Test6179222.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #16
Source File: Test6179222.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #17
Source File: Test6179222.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #18
Source File: Test6179222.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #19
Source File: Test6179222.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    Test6179222 test = new Test6179222();
    // test 6179222
    test(EventHandler.create(ActionListener.class, test, "foo", "source.icon"));
    // test 6265540
    test(EventHandler.create(ActionListener.class, test, "bar.doit"));
    if (!test.bar.invoked) {
        throw new Error("Bar was not set");
    }
}
 
Example #20
Source File: OptionsWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * @return Login components.
 */
private Component createCommandComponents() {
  JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));

  // Apply button
  buttonApply = Utilities.createJButton(
      GT._T("Apply"),
      ConfigurationValueShortcut.APPLY);
  buttonApply.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionApply"));
  panel.add(buttonApply);

  // Validate button
  buttonValidate = Utilities.createJButton(
      GT._T("Validate"),
      ConfigurationValueShortcut.VALIDATE);
  buttonValidate.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionValidate"));
  panel.add(buttonValidate);

  // Cancel button
  buttonCancel = ActionDispose.createButton(getParentComponent(), true, true);
  panel.add(buttonCancel);

  // Restore defaults button
  buttonDefault = Utilities.createJButton(
      GT._T("Restore defaults"),
      ConfigurationValueShortcut.RESTORE_DEFAULTS);
  buttonDefault.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionDefault"));
  panel.add(buttonDefault);

  return panel;
}
 
Example #21
Source File: OnePageWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Add a component for the Disambiguation button.
 * 
 * @param panel Container.
 * @param icon Flag indicating if an icon should be used.
 */
protected void addButtonDisambiguation(JComponent panel, boolean icon) {
  if (buttonDisambiguation == null) {
    if (icon) {
      buttonDisambiguation = Utilities.createJButton(
          "commons-disambig-colour.png", EnumImageSize.NORMAL,
          GT._T("Disambiguation"), false, null);
    } else {
      buttonDisambiguation = Utilities.createJButton(GT._T("Disambiguation"), null);
    }
    buttonDisambiguation.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionDisambiguation"));
    panel.add(buttonDisambiguation);
  }
}
 
Example #22
Source File: OnePageWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Add a component for the Redirect buttons.
 * 
 * @param panel Container.
 */
protected void addButtonRedirect(JComponent panel) {
  buttonAnalysisRedirect = Utilities.createJButton(
      "commons-redirect-arrow-without-text.png", EnumImageSize.NORMAL,
      GT._T("Redirect"), false, null);
  buttonAnalysisRedirect.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionAnalysisRedir"));
  panel.add(buttonAnalysisRedirect);
}
 
Example #23
Source File: MainWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Add an item to the generate lists menu.
 * 
 * @param menu Menu.
 * @param mode List to be generated.
 */
private void addItemInInternalLinks(JPopupMenu menu, PageListWorker.Mode mode) {
  JMenuItem item = Utilities.createJMenuItem(mode.getTitle(), true);
  item.setActionCommand(mode.name());
  item.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionInternalLinks", "actionCommand"));
  menu.add(item);
}
 
Example #24
Source File: MainWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Add an item to the generate lists menu.
 * 
 * @param menu Menu.
 * @param mode List to be generated.
 */
private void addItemInGenerateLists(JPopupMenu menu, PageListWorker.Mode mode) {
  JMenuItem item = Utilities.createJMenuItem(mode.getTitle(), true);
  item.setActionCommand(mode.name());
  item.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionGenerateList", "actionCommand"));
  menu.add(item);
}
 
Example #25
Source File: DisambiguationWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * @return Filter namespace menu.
 */
private JMenu createFilterMenu() {
  if (menuFilter == null) {
    menuFilter = Utilities.createJMenu(GT._T("Filter namespaces"));
  } else {
    menuFilter.removeAll();
  }
  EnumWikipedia wiki = getWikipedia();
  if (wiki == null) {
    return menuFilter;
  }
  Configuration config = Configuration.getConfiguration();
  List<String> filtered = config.getStringList(wiki, Configuration.ARRAY_FILTER_NS);
  for (Namespace ns : wiki.getWikiConfiguration().getNamespaces()) {
    Integer id = ns.getId();
    if ((id != null) && (id.intValue() >= 0)) {
      boolean active = !filtered.contains(Integer.toString(ns.getId()));
      JMenuItem item = new JCheckBoxMenuItem(
          ns.toString(), active);
      item.setActionCommand(id.toString());
      item.addActionListener(EventHandler.create(
          ActionListener.class, this,
          active ? "actionFilterNamespaceTrue" : "actionFilterNamespaceFalse",
          "actionCommand"));
      menuFilter.add(item);
    }
  }
  return menuFilter;
}
 
Example #26
Source File: HelpButton.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param parentComponent Parent component.
 * @param wikiProvider Provider for the wiki.
 */
public HelpButton(Component parentComponent, WikiProvider wikiProvider) {
  this.parentComponent = parentComponent;
  this.wikiProvider = wikiProvider;
  
  // Create button
  button = Utilities.createJButton(
      "tango-help-browser.png", EnumImageSize.NORMAL,
      GT._T("Help"), true,
      ConfigurationValueShortcut.HELP);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionHelp"));
}
 
Example #27
Source File: IdeaButton.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param parentComponent Parent component.
 */
public IdeaButton(Component parentComponent) {
  this.parentComponent = parentComponent;
  
  // Create button
  button = Utilities.createJButton(
      GT._T("Idea? Bug?"),
      ConfigurationValueShortcut.BUG_REPORT);
  button.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionIdea"));
}
 
Example #28
Source File: LanguageSelector.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param parentComponent Parent component.
 */
public LanguageSelector(Component parentComponent) {
  this.parentComponent = parentComponent;
  this.changeListeners = new ArrayList<>();

  // Create combo box
  Configuration configuration = Configuration.getConfiguration();
  EnumLanguage defaultLanguage = configuration.getLanguage();
  combo = new JComboBox<>(EnumLanguage.getList().toArray(new EnumLanguage[0]));
  combo.setEditable(false);
  combo.setSelectedItem(defaultLanguage);
  combo.addItemListener(EventHandler.create(
      ItemListener.class, this, "notifyLanguageChange"));

  // Create label
  label = Utilities.createJLabel(GT._T("Language"));
  label.setLabelFor(combo);
  label.setHorizontalAlignment(SwingConstants.TRAILING);

  // Create button
  toolbar = new JToolBar(SwingConstants.HORIZONTAL);
  toolbar.setFloatable(false);
  toolbar.setBorderPainted(false);
  JButton buttonLanguageInfo = Utilities.createJButton(
      "tango-help-browser.png", EnumImageSize.SMALL,
      GT._T("Other Language"), false, null);
  buttonLanguageInfo.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionOtherLanguage"));
  toolbar.add(buttonLanguageInfo);
}
 
Example #29
Source File: WikiSelector.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param parentComponent Parent component.
 */
public WikiSelector(Component parentComponent) {
  this.parentComponent = parentComponent;
  this.changeListeners = new ArrayList<>();
  
  // Create combo box
  Configuration configuration = Configuration.getConfiguration();
  EnumWikipedia defaultWikipedia = configuration.getWikipedia();
  combo = new JComboBox<>(EnumWikipedia.getList().toArray(new EnumWikipedia[0]));
  combo.setEditable(false);
  combo.setSelectedItem(defaultWikipedia);
  combo.addItemListener(EventHandler.create(
      ItemListener.class, this, "notifyWikiChange"));

  // Create label
  label = Utilities.createJLabel(GT._T("Wiki"));
  label.setLabelFor(combo);
  label.setHorizontalAlignment(SwingConstants.TRAILING);

  // Create button
  toolbar = new JToolBar(SwingConstants.HORIZONTAL);
  toolbar.setFloatable(false);
  toolbar.setBorderPainted(false);
  JButton buttonWikiInfo = Utilities.createJButton(
      "tango-help-browser.png", EnumImageSize.SMALL,
      GT._T("Other Wiki"), false, null);
  buttonWikiInfo.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionOtherWiki"));
  toolbar.add(buttonWikiInfo);
}
 
Example #30
Source File: CWToolsPanel.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Action called when Load Selection button is pressed.
 */
public void actionLoadSelection() {

  // Retrieve possible selections
  Configuration config = Configuration.getConfiguration();
  Properties properties = config.getProperties(null, Configuration.ARRAY_CHECK_BOT_SELECTION);
  if ((properties == null) || (properties.isEmpty())) {
    return;
  }
  Set<Object> keySet = properties.keySet();
  List<String> keyList = new ArrayList<String>();
  for (Object key : keySet) {
    keyList.add(key.toString());
  }
  Collections.sort(keyList);

  // Create menu
  JPopupMenu menu = new JPopupMenu();
  for (String name : keyList) {
    JMenuItem item = Utilities.createJMenuItem(name, true);
    item.setActionCommand(properties.getProperty(name));
    item.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionLoadSelection", "actionCommand"));
    menu.add(item);
  }
  menu.show(
      buttonLoadSelection,
      0,
      buttonLoadSelection.getHeight());
}