This example creates the notepadWindow test object.
Inside the notepadWindow hierarchy, it creates a Menu test object to represent the main NotePad menu.
Inside the notepadMenu hierarchy, it uses the buildMenuPath method to create a test object for the Format > Font sub-menu command and to perform the select operation on that object.
Finally, it creates a notepadFontDialog object as a child of the main notepadWindow and the fontsComboBox object as a child of the dialog box.
Window notepadWindow = Desktop.describe(Window.class, new WindowDescription.Builder().windowClassRegExp("Notepad").windowTitleRegExp(" Notepad").build());
Menu notepadMenu = notepadWindow.describe(Menu.class, new MenuDescription(MenuType.MENU));
// Build the "Format"-->"Font" menu item
String path = notepadMenu.buildMenuPath("Format", 2);
// Open the "Font" dialog by selecting "Format"-->"Font" in the menu
MenuItem menuItem = notepadMenu.getItem(path);
notepadMenu.select(menuItem);
Dialog notepadFontDialog = notepadWindow.describe(Dialog.class, new DialogDescription.Builder().windowTitleRegExp("Font").build());
ComboBox fontsComboBox = notepadFontDialog.describe(ComboBox.class, new ComboBoxDescription.Builder().attachedText("&Font:").nativeClass("ComboBox").build());