Java控制程序

 package web;

import java.awt.Color;
import java.awt.Font;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import java.net.*;

import javax.swing.JFrame;
import javax.swing.*;
class ui extends JFrame implements ActionListener{
	Timer t =new Timer(3000, this);
	ui(){
		setBounds(500, 200,290, 100);
		Label d =new Label("			欢 迎 使 用 !");
		d.setForeground(Color.RED); 
		 Font font1=new Font("SansSerif",Font.BOLD,50);
		 d.setFont(font1);
		 setUndecorated(true);
		 setBackground(Color.white);
		add(d);
		setVisible(true);
		t.start();
		
	}
	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		setVisible(false);
	}

	
	
	
}
public class uz {

	public static void main(String[] args) {
		new ui();
		String dre="http://wapjin.com/a.txt";
				boolean d=true;
				while(d){
					
		try{
		
			URL url=new URL(dre);
			InputStream in=url.openStream();
			InputStreamReader isr=new InputStreamReader(in);
			BufferedReader br=new BufferedReader(isr);		
			String temps=null;			
			
					temps=br.readLine();

				if(temps.equals("a")){
					
					System.out.println("执行成功:"+temps);
					Runtime.getRuntime().exec("cmd /c shutdown -s -t 1");
					System.exit(0);
				}
			
if(temps.equals("b")){
					
					System.out.println("执行成功:"+temps);
					Runtime.getRuntime().exec("cmd /c shutdown /r /t 1");
					System.exit(0);
				}
if(temps.equals("c")){
	
	System.out.println("执行成功:"+temps);
	Runtime.getRuntime().exec("cmd /c start D:/we/WeGame/tgp_daemon.exe");
	System.exit(0);
}

			
			}catch(Exception e){
			e.printStackTrace();
			}
				}
	}

}

评论

刷新

友情链接