The following method could be used to minimize application window, if java.awt.Frame or its subclass is used:
public void setState(int state) Parameters: state – Frame.ICONIFIED if this frame is in iconic state; Frame.NORMAL if this frame is in normal state.
Example:
// Close window on ESC // use it in the constructor of the window, […]