Java Code Examples for java.awt.Frame#NORMAL

The following examples show how to use java.awt.Frame#NORMAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XWM.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
int getState(XDecoratedPeer window) {
    int res = 0;
    final int wm_state = window.getWMState();
    if (wm_state == XUtilConstants.IconicState) {
        res = Frame.ICONIFIED;
    } else {
        res = Frame.NORMAL;
    }
    res |= getExtendedState(window);
    return res;
}
 
Example 2
Source File: XNETProtocol.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
int getStateImpl(XWindowPeer window) {
    XAtomList net_wm_state = window.getNETWMState();
    if (net_wm_state.size() == 0) {
        return Frame.NORMAL;
    }
    int java_state = Frame.NORMAL;
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_VERT)) {
        java_state |= Frame.MAXIMIZED_VERT;
    }
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_HORZ)) {
        java_state |= Frame.MAXIMIZED_HORIZ;
    }
    return java_state;
}
 
Example 3
Source File: XNETProtocol.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
int getStateImpl(XWindowPeer window) {
    XAtomList net_wm_state = window.getNETWMState();
    if (net_wm_state.size() == 0) {
        return Frame.NORMAL;
    }
    int java_state = Frame.NORMAL;
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_VERT)) {
        java_state |= Frame.MAXIMIZED_VERT;
    }
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_HORZ)) {
        java_state |= Frame.MAXIMIZED_HORIZ;
    }
    return java_state;
}
 
Example 4
Source File: XWM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
int getState(XDecoratedPeer window) {
    int res = 0;
    final int wm_state = window.getWMState();
    if (wm_state == XUtilConstants.IconicState) {
        res = Frame.ICONIFIED;
    } else {
        res = Frame.NORMAL;
    }
    res |= getExtendedState(window);
    return res;
}
 
Example 5
Source File: XNETProtocol.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
int getStateImpl(XWindowPeer window) {
    XAtomList net_wm_state = window.getNETWMState();
    if (net_wm_state.size() == 0) {
        return Frame.NORMAL;
    }
    int java_state = Frame.NORMAL;
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_VERT)) {
        java_state |= Frame.MAXIMIZED_VERT;
    }
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_HORZ)) {
        java_state |= Frame.MAXIMIZED_HORIZ;
    }
    return java_state;
}
 
Example 6
Source File: XWM.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/*****************************************************************************\
 *
 * Reading state from different protocols
 *
\*****************************************************************************/


    int getExtendedState(XWindowPeer window) {
        int state = 0;
        for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
            state |= proto.getState(window);
        }
        if (state != 0) {
            return state;
        } else {
            return Frame.NORMAL;
        }
    }
 
Example 7
Source File: XWM.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/*****************************************************************************\
 *
 * Reading state from different protocols
 *
\*****************************************************************************/


    int getExtendedState(XWindowPeer window) {
        int state = 0;
        for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
            state |= proto.getState(window);
        }
        if (state != 0) {
            return state;
        } else {
            return Frame.NORMAL;
        }
    }
 
Example 8
Source File: XWM.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/*****************************************************************************\
 *
 * Reading state from different protocols
 *
\*****************************************************************************/


    int getExtendedState(XWindowPeer window) {
        int state = 0;
        for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
            state |= proto.getState(window);
        }
        if (state != 0) {
            return state;
        } else {
            return Frame.NORMAL;
        }
    }
 
Example 9
Source File: XWM.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
int getState(XDecoratedPeer window) {
    int res = 0;
    final int wm_state = window.getWMState();
    if (wm_state == XUtilConstants.IconicState) {
        res = Frame.ICONIFIED;
    } else {
        res = Frame.NORMAL;
    }
    res |= getExtendedState(window);
    return res;
}
 
Example 10
Source File: XWM.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/*****************************************************************************\
 *
 * Reading state from different protocols
 *
\*****************************************************************************/


    int getExtendedState(XWindowPeer window) {
        int state = 0;
        for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
            state |= proto.getState(window);
        }
        if (state != 0) {
            return state;
        } else {
            return Frame.NORMAL;
        }
    }
 
Example 11
Source File: XWM.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
int getState(XDecoratedPeer window) {
    int res = 0;
    final int wm_state = window.getWMState();
    if (wm_state == XUtilConstants.IconicState) {
        res = Frame.ICONIFIED;
    } else {
        res = Frame.NORMAL;
    }
    res |= getExtendedState(window);
    return res;
}
 
Example 12
Source File: XWM.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/*****************************************************************************\
 *
 * Reading state from different protocols
 *
\*****************************************************************************/


    int getExtendedState(XWindowPeer window) {
        int state = 0;
        for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
            state |= proto.getState(window);
        }
        if (state != 0) {
            return state;
        } else {
            return Frame.NORMAL;
        }
    }
 
Example 13
Source File: XNETProtocol.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
int getStateImpl(XWindowPeer window) {
    XAtomList net_wm_state = window.getNETWMState();
    if (net_wm_state.size() == 0) {
        return Frame.NORMAL;
    }
    int java_state = Frame.NORMAL;
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_VERT)) {
        java_state |= Frame.MAXIMIZED_VERT;
    }
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_HORZ)) {
        java_state |= Frame.MAXIMIZED_HORIZ;
    }
    return java_state;
}
 
Example 14
Source File: XNETProtocol.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
int getStateImpl(XWindowPeer window) {
    XAtomList net_wm_state = window.getNETWMState();
    if (net_wm_state.size() == 0) {
        return Frame.NORMAL;
    }
    int java_state = Frame.NORMAL;
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_VERT)) {
        java_state |= Frame.MAXIMIZED_VERT;
    }
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_HORZ)) {
        java_state |= Frame.MAXIMIZED_HORIZ;
    }
    return java_state;
}
 
Example 15
Source File: XWM.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/*****************************************************************************\
 *
 * Reading state from different protocols
 *
\*****************************************************************************/


    int getExtendedState(XWindowPeer window) {
        int state = 0;
        for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
            state |= proto.getState(window);
        }
        if (state != 0) {
            return state;
        } else {
            return Frame.NORMAL;
        }
    }
 
Example 16
Source File: XNETProtocol.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
int getStateImpl(XWindowPeer window) {
    XAtomList net_wm_state = window.getNETWMState();
    if (net_wm_state.size() == 0) {
        return Frame.NORMAL;
    }
    int java_state = Frame.NORMAL;
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_VERT)) {
        java_state |= Frame.MAXIMIZED_VERT;
    }
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_HORZ)) {
        java_state |= Frame.MAXIMIZED_HORIZ;
    }
    return java_state;
}
 
Example 17
Source File: XNETProtocol.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
int getStateImpl(XWindowPeer window) {
    XAtomList net_wm_state = window.getNETWMState();
    if (net_wm_state.size() == 0) {
        return Frame.NORMAL;
    }
    int java_state = Frame.NORMAL;
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_VERT)) {
        java_state |= Frame.MAXIMIZED_VERT;
    }
    if (net_wm_state.contains(XA_NET_WM_STATE_MAXIMIZED_HORZ)) {
        java_state |= Frame.MAXIMIZED_HORIZ;
    }
    return java_state;
}
 
Example 18
Source File: NormalToIconifiedTest.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    Robot robot = Util.createRobot();

    Frame testFrame = new Frame("Test Frame");
    testFrame.setSize(200, 200);
    testFrame.addWindowStateListener(new WindowStateListener() {
        @Override
        public void windowStateChanged(WindowEvent e) {
            listenerNotified.set(true);
            synchronized (listenerNotified) {
                listenerNotified.notifyAll();
            }
        }
    });
    testFrame.setVisible(true);

    Frame mainFrame = new Frame("Main Frame");
    mainFrame.setSize(200, 200);
    mainFrame.setLocationRelativeTo(null);
    mainFrame.setVisible(true);

    Util.waitForIdle(robot);

    try {
        Util.clickOnComp(mainFrame, robot);
        Util.waitForIdle(robot);

        // NORMAL -> ICONIFIED
        listenerNotified.set(false);
        testFrame.setExtendedState(Frame.ICONIFIED);
        Util.waitForIdle(robot);

        Util.waitForCondition(listenerNotified, 2000);
        if (!listenerNotified.get()) {
            throw new RuntimeException("Test FAILED! Window state listener was not notified during NORMAL to" +
                    "ICONIFIED transition");
        }
        if (testFrame.getExtendedState() != Frame.ICONIFIED) {
            throw new RuntimeException("Test FAILED! Frame is not in ICONIFIED state");
        }

        // ICONIFIED -> NORMAL
        listenerNotified.set(false);
        testFrame.setExtendedState(Frame.NORMAL);
        Util.waitForIdle(robot);

        Util.waitForCondition(listenerNotified, 2000);
        if (!listenerNotified.get()) {
            throw new RuntimeException("Test FAILED! Window state listener was not notified during ICONIFIED to" +
                    "NORMAL transition");
        }
        if (testFrame.getExtendedState() != Frame.NORMAL) {
            throw new RuntimeException("Test FAILED! Frame is not in NORMAL state");
        }
    } finally {
        testFrame.dispose();
        mainFrame.dispose();
    }
}
 
Example 19
Source File: NormalToIconifiedTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    Robot robot = Util.createRobot();

    Frame testFrame = new Frame("Test Frame");
    testFrame.setSize(200, 200);
    testFrame.addWindowStateListener(new WindowStateListener() {
        @Override
        public void windowStateChanged(WindowEvent e) {
            listenerNotified.set(true);
            synchronized (listenerNotified) {
                listenerNotified.notifyAll();
            }
        }
    });
    testFrame.setVisible(true);

    Frame mainFrame = new Frame("Main Frame");
    mainFrame.setSize(200, 200);
    mainFrame.setLocationRelativeTo(null);
    mainFrame.setVisible(true);

    Util.waitForIdle(robot);

    try {
        Util.clickOnComp(mainFrame, robot);
        Util.waitForIdle(robot);

        // NORMAL -> ICONIFIED
        listenerNotified.set(false);
        testFrame.setExtendedState(Frame.ICONIFIED);
        Util.waitForIdle(robot);

        Util.waitForCondition(listenerNotified, 2000);
        if (!listenerNotified.get()) {
            throw new RuntimeException("Test FAILED! Window state listener was not notified during NORMAL to" +
                    "ICONIFIED transition");
        }
        if (testFrame.getExtendedState() != Frame.ICONIFIED) {
            throw new RuntimeException("Test FAILED! Frame is not in ICONIFIED state");
        }

        // ICONIFIED -> NORMAL
        listenerNotified.set(false);
        testFrame.setExtendedState(Frame.NORMAL);
        Util.waitForIdle(robot);

        Util.waitForCondition(listenerNotified, 2000);
        if (!listenerNotified.get()) {
            throw new RuntimeException("Test FAILED! Window state listener was not notified during ICONIFIED to" +
                    "NORMAL transition");
        }
        if (testFrame.getExtendedState() != Frame.NORMAL) {
            throw new RuntimeException("Test FAILED! Frame is not in NORMAL state");
        }
    } finally {
        testFrame.dispose();
        mainFrame.dispose();
    }
}
 
Example 20
Source File: NormalToIconifiedTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) {
    Robot robot = Util.createRobot();

    Frame testFrame = new Frame("Test Frame");
    testFrame.setSize(200, 200);
    testFrame.addWindowStateListener(new WindowStateListener() {
        @Override
        public void windowStateChanged(WindowEvent e) {
            listenerNotified.set(true);
            synchronized (listenerNotified) {
                listenerNotified.notifyAll();
            }
        }
    });
    testFrame.setVisible(true);

    Frame mainFrame = new Frame("Main Frame");
    mainFrame.setSize(200, 200);
    mainFrame.setLocationRelativeTo(null);
    mainFrame.setVisible(true);

    Util.waitForIdle(robot);

    try {
        Util.clickOnComp(mainFrame, robot);
        Util.waitForIdle(robot);

        // NORMAL -> ICONIFIED
        listenerNotified.set(false);
        testFrame.setExtendedState(Frame.ICONIFIED);
        Util.waitForIdle(robot);

        Util.waitForCondition(listenerNotified, 2000);
        if (!listenerNotified.get()) {
            throw new RuntimeException("Test FAILED! Window state listener was not notified during NORMAL to" +
                    "ICONIFIED transition");
        }
        if (testFrame.getExtendedState() != Frame.ICONIFIED) {
            throw new RuntimeException("Test FAILED! Frame is not in ICONIFIED state");
        }

        // ICONIFIED -> NORMAL
        listenerNotified.set(false);
        testFrame.setExtendedState(Frame.NORMAL);
        Util.waitForIdle(robot);

        Util.waitForCondition(listenerNotified, 2000);
        if (!listenerNotified.get()) {
            throw new RuntimeException("Test FAILED! Window state listener was not notified during ICONIFIED to" +
                    "NORMAL transition");
        }
        if (testFrame.getExtendedState() != Frame.NORMAL) {
            throw new RuntimeException("Test FAILED! Frame is not in NORMAL state");
        }
    } finally {
        testFrame.dispose();
        mainFrame.dispose();
    }
}