我有一个用于自动关闭系统的 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 网络浏览器。这涉及进行各种编码并将它们放在一个文件夹中并将该文件夹加载到网络浏览器中。我的问题是如何使用此代码为谷歌浏览器制作“插件”?