NativeSearchFieldSupport { public static void setFindAction(JTextField txt, ActionListener findAction) { txt.putClientProperty(FIND_ACTION_PROPERTY, findAction); }  static boolean isNativeSearchFieldSupported(); static void setSearchField(JTextField txt, boolean isSearchField); static boolean isSearchField(JTextField txt); static boolean isNativeSearchField(JTextField txt); static void setFindPopupMenu(JTextField txt, JPopupMenu popupMenu); static JPopupMenu getFindPopupMenu(JTextField txt); static void setFindAction(JTextField txt, ActionListener findAction); static ActionListener getFindAction(JTextField txt); static void setCancelAction(JTextField txt, ActionListener cancelAction); static ActionListener getCancelAction(JTextField txt); static final String FIND_POPUP_PROPERTY; static final String FIND_ACTION_PROPERTY; static final String MAC_SEARCH_VARIANT; static final String MAC_TEXT_FIELD_VARIANT_PROPERTY; static final String CANCEL_ACTION_PROPERTY; }
@Test public void testFindActionPropertyChangeEvent() throws Exception { tf.addPropertyChangeListener(NativeSearchFieldSupport.FIND_ACTION_PROPERTY, this); NativeSearchFieldSupport.setFindAction(tf, new ActionListener(){ public void actionPerformed(ActionEvent e) { eventFired = true; } }); Assert.assertTrue(eventFired); eventFired = false; NativeSearchFieldSupport.setFindAction(tf, null); Assert.assertTrue(eventFired); }