package Lanmbda;

import javax.swing.*;
import java.io.IOException;

public class close{
public static void main(String[] args) throws IOException {
int i=10;
Object[] options = { "确定", "取消" };
JOptionPane.showOptionDialog(null, "电脑将强制关机", "警告",
JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
null, options, options[0]);
while(true){
if (i==0)
break;


JOptionPane.showMessageDialog(null, i, "关机倒计时", JOptionPane.ERROR_MESSAGE);
i--;
}

Runtime s= Runtime.getRuntime();
s.exec("shutdown -s -t 00");
// System.out.println("电脑已经关机");
}
}