How to trap the Window state?
I'd a snipped and want to know how to trap it?

    frame.addWindowStateListener(new WindowStateListener(){
        public void windowStateChanged(WindowEvent e) {
            System.out.println(e.getNewState());//I need to trap this state when it prints 7
        }
    });

When the instance of frame is visible then after `maximizing` and then clicking on `minimize` button it prints `7`(the state of window). I need to trap that state. Can any body tell me how to do so?
How to trap the Window state?
===

I'd a snipped and want to know how to trap it?

    frame.addWindowStateListener(new WindowStateListener(){
        public void windowStateChanged(WindowEvent e) {
            System.out.println(e.getNewState());//I need to trap this state when it prints 7
        }
    });

When the instance of frame is visible then after `maximizing` and then clicking on `minimize` button it prints `7`(the state of window). I need to trap that state. Can any body tell me how to do so?