0
我有一個用於自動關閉系統的java代碼。 的代碼如下: -如何創建自動關閉系統的谷歌瀏覽器插件
import javax.swing.JOptionPane;
public class sd
{
public static void main(String[]args)
{
int wholeTimeBeforeShutdown=0;
int hour=0;
int minute=0;
int second=0;
try
{
String a=JOptionPane.showInputDialog(null,"HOUR","HOUR BEFORE SHUTDOWN",JOptionPane.QUESTION_MESSAGE);
String b=JOptionPane.showInputDialog(null,"MINUTE","MINUTE BEFORE SHUTDOWN",JOptionPane.QUESTION_MESSAGE);
String c=JOptionPane.showInputDialog(null,"SECOND","SECOND BEFORE SHUTDOWN",JOptionPane.QUESTION_MESSAGE);
if((a==null)||a.equals(""))
{
a="0";
}
if((b==null)||b.equals(""))
{
b="0";
}
if((c==null)||c.equals(""))
{
c="0";
}
int e=Integer.parseInt(a);
int f=Integer.parseInt(b);
int g=Integer.parseInt(c);
wholeTimeBeforeShutdown=wholeTimeBeforeShutdown+((e*60)*60);
wholeTimeBeforeShutdown=wholeTimeBeforeShutdown+((f*60));
wholeTimeBeforeShutdown=wholeTimeBeforeShutdown+(g);
wholeTimeBeforeShutdown=wholeTimeBeforeShutdown*1000;
Thread.sleep(wholeTimeBeforeShutdown);
Runtime.getRuntime().exec("shutdown -s -t 00 -f");
}
catch(Exception exception)
{
exception.printStackTrace();
}
}
}
我想利用這個代碼來創建谷歌瀏覽器時自動關閉系統中的插件。我知道如何在Chrome瀏覽器中添加一個插件,包括做各種編碼並將它們放在一個文件夾中並將該文件夾加載到Web瀏覽器中。 我的問題是如何使用此代碼爲谷歌瀏覽器做一個「插件」?
爲什麼你需要關閉系統從Chrome?!? – Hydroid 2013-04-06 12:30:17
我正在做一個關於chrome插件的項目,其中我應該使用插件關閉系統。 – 2013-04-06 12:38:06