类java.beans.EventHandler源码实例Demo

下面列出了怎么用java.beans.EventHandler的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: wpcleaner   文件: GoToExternalRenderer.java
/**
 * 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;
}
 
源代码2 项目: wpcleaner   文件: PageCommentsWindow.java
/**
 * @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;
}
 
源代码3 项目: wpcleaner   文件: OnePageWindow.java
/**
 * @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;
}
 
源代码4 项目: wpcleaner   文件: DetectionRenderer.java
/**
 * 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;
}
 
源代码5 项目: wpcleaner   文件: MainWindow.java
/**
 * 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());
}
 
源代码6 项目: wpcleaner   文件: LanguageSelectionPanel.java
/**
 * 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());
}
 
源代码7 项目: wpcleaner   文件: GoToIntervalRenderer.java
/**
 * 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;
}
 
源代码8 项目: wpcleaner   文件: CopyCellRenderer.java
/**
 * 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;
}
 
源代码9 项目: wpcleaner   文件: UserNameSelector.java
/**
 * 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);
}
 
源代码10 项目: wpcleaner   文件: GoToRenderer.java
/**
 * 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;
}
 
源代码11 项目: dragonwell8_jdk   文件: Test6179222.java
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");
    }
}
 
源代码12 项目: TencentKona-8   文件: Test6179222.java
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");
    }
}
 
源代码13 项目: jdk8u60   文件: Test6179222.java
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");
    }
}
 
源代码14 项目: openjdk-jdk8u   文件: Test6179222.java
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");
    }
}
 
源代码15 项目: openjdk-jdk8u-backup   文件: Test6179222.java
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");
    }
}
 
源代码16 项目: openjdk-jdk9   文件: Test6179222.java
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");
    }
}
 
源代码17 项目: jdk8u-jdk   文件: Test6179222.java
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");
    }
}
 
源代码18 项目: hottub   文件: Test6179222.java
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");
    }
}
 
源代码19 项目: wpcleaner   文件: ActionUpdateWarning.java
/**
 * 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());
}
 
源代码20 项目: openjdk-8-source   文件: Test6179222.java
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");
    }
}
 
源代码21 项目: openjdk-8   文件: Test6179222.java
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");
    }
}
 
源代码22 项目: jdk8u_jdk   文件: Test6179222.java
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");
    }
}
 
源代码23 项目: jdk8u-jdk   文件: Test6179222.java
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");
    }
}
 
源代码24 项目: jdk8u-dev-jdk   文件: Test6179222.java
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");
    }
}
 
源代码25 项目: wpcleaner   文件: OptionsWindow.java
/**
 * @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;
}
 
源代码26 项目: wpcleaner   文件: OnePageWindow.java
/**
 * 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);
  }
}
 
源代码27 项目: wpcleaner   文件: OnePageWindow.java
/**
 * 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);
}
 
源代码28 项目: wpcleaner   文件: MainWindow.java
/**
 * 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);
}
 
源代码29 项目: wpcleaner   文件: MainWindow.java
/**
 * 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);
}
 
源代码30 项目: wpcleaner   文件: DisambiguationWindow.java
/**
 * @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;
}
 
 类所在包
 类方法
 同包方法