Java Code Examples for java.lang.System#exit()

The following examples show how to use java.lang.System#exit() . 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: CursorStim.java    From buffer_bci with GNU General Public License v3.0 7 votes vote down vote up
public void display(){
     JFrame frame = new JFrame("Cursor Stim");
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 frame.setTitle("Cursor Stim");
     frame.getContentPane().add(this, BorderLayout.CENTER);
 frame.pack();
     frame.setVisible(true);
     
     // start the experiment controller thread
     startControllerThread();
     
     // run the main-loop rendering loop
     renderloop();
     
 // run the experiment
 frame.dispose();
 System.exit(0);
}
 
Example 2
Source File: FullScreenAfterSplash.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 3
Source File: FullScreenAfterSplash.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 4
Source File: FullScreenAfterSplash.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 5
Source File: FullScreenAfterSplash.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 6
Source File: FullScreenAfterSplash.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 7
Source File: FullScreenAfterSplash.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.setAutoDelay(50);
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            if(System.getProperty("os.version").equals("10.9"))
                fullScreenButtonPos.translate(frame.getWidth() - 10, frame.getHeight()/2);
            else
                fullScreenButtonPos.translate(55,frame.getHeight()/2);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 8
Source File: FullScreenAfterSplash.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 9
Source File: FullScreenAfterSplash.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 10
Source File: FullScreenAfterSplash.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 11
Source File: FullScreenAfterSplash.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }
 
Example 12
Source File: FullScreenAfterSplash.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {

        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
            System.out.println("The test is applicable only to Mac OS X. Passed");
            return;
        }
        try {
            //Move the mouse out, because it could interfere with the test.
            Robot r = new Robot();
            r.mouseMove(0, 0);
            sleep();

            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
            sleep();

            Point fullScreenButtonPos = frame.getLocation();
            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);

            //Cant use waitForIdle for full screen transition.
            int waitCount = 0;
            while (!windowEnteringFullScreen) {
                r.mousePress(InputEvent.BUTTON1_MASK);
                r.mouseRelease(InputEvent.BUTTON1_MASK);
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }

            waitCount = 0;
            while (!windowEnteredFullScreen) {
                Thread.sleep(100);
                if (waitCount++ > 10) {
                    System.err.println("Can't enter full screen mode. Failed.");
                    System.exit(1);
                }
            }
        } finally {
            if (frame != null) {
                frame.dispose();
            }
        }
    }