Menu

JOptionPane with the default button

Help
Marco fre
2005-08-01
2013-04-09
  • Marco fre

    Marco fre - 2005-08-01

    In my application I uses a menuItem call to show a JOptionPane  with the default OK, Cancel Button. How can I find the components buttons (Ok, Cancel) in order to click them?
    I always used the NamedComponentFinder but in this case I can' t assign a name to the buttons.

    Thanks
    Marco

     
    • Etienne Studer

      Etienne Studer - 2005-08-01

      When I have a confirm dialog with a "Delete" title, I use something like this:

      Finder finder = new DialogFinder("Delete", true);
      JDialog dialog = (JDialog) finder.find(inParent, 0);

      Finder finder = new AbstractButtonFinder("OK", true);
      AbstractButton confirmButton = (AbstractButton) finder.find(inContainer, 0);

      Not internationalizable like when using the name attribute, though.

      --Etienne

       

Log in to post a comment.