Enumerating all dialogs

  1. Get all frames

  2. Get each frame's owned windows with getOwnedWindows()

    public void testPresentMovieDialog() {
        
        JMenuItem presentMovie = findJMenuItem(menubar, "Present Movie");
        presentMovie.doClick();
        
        Frame[] allFrames = Frame.getFrames();
        for (int i = 0; i < allFrames.length; i++) {
            Window[] owned = allFrames[i].getOwnedWindows();
            for (int j = 0; j < allFrames.length; j++) {
                Dialog dialog = (Dialog) owned[j];
                if ("Present Movie".equals(dialog.getTitle())) {
                    return;
                }
            }
        }
        fail("No present dialog");
        
    }

Previous | Next | Top | Cafe con Leche

Copyright 2005, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified August 11, 2005