下面列出了java.lang.System#exit ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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);
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}
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();
}
}
}