Maximizing, minimizing Windows, Frames (AWT, Swing)

Last edited on

Example

Here is an example of how to maximize and minimize javax.swing.JFrame instances:

def main():
    #...

    windowName = {"caption": "Address Book", "type": "AddressBook", "visible": True}
    window = waitForObject(windowName)

    test.log("Setting maximized...")
    window.setExtendedState(java_awt_Frame.MAXIMIZED_BOTH)
    snooze(1)

    test.log("Setting normal...")
    window.setExtendedState(java_awt_Frame.NORMAL)
    snooze(1)

    test.log("Setting iconified...")
    window.setExtendedState(java_awt_Frame.ICONIFIED)
    snooze(1)
test.py

Notice that the setExtendedState() method is from the Java AWT/Swing API. The Java APIs of AUT objects retrieved by Squish can be accessed without formality.