⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studel.java

📁 学籍管理系统,可以实现多方面学生学籍的管理
💻 JAVA
字号:
/*
 * Created on 2005-12-6
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */

/**
 * @author tian
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import java.net.*;
import java.io.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class stuDel extends Applet implements Runnable,ActionListener
{

	  TextField txt_no;  
	  Button btn_add=new Button();
	  Label tishi;
	  Label xianshi;
	  Socket socket=null;
	  DataInputStream in=null;
	  DataOutputStream out=null;
	  Thread thread; 

	public void init(){
		  txt_no=new TextField(10);		 
	
		  btn_add=new Button("删除");//又删除	  
		  tishi=new Label("正在连接到服务器,请稍等...",Label.CENTER);
		  tishi.setForeground(Color.red);
		  tishi.setFont(new Font("TimesRoman",Font.BOLD,24));
		  xianshi=new Label("提示结果");
		  Panel box1=new Panel();  
		  Panel box2=new Panel();
		  box1.add(new Label("输入删除学号:",Label.CENTER));
		  box2.add(xianshi);
		  
		  box1.add(txt_no); 
		  box1.add(btn_add);//又删除	 
		  add(tishi);
		  add(box1);	
		  add(box2);
		  btn_add.addActionListener(this);//又删除		  
		}
	public void start(){
		if(socket!=null&&in!=null&&out!=null)
      {  try
            {
              socket.close();
              in.close(); 
              out.close();
            }
        catch(Exception ee)
            {
            }
      }
   try
      {
        socket=new Socket(this.getCodeBase().getHost(), 6662);
        in=new DataInputStream(socket.getInputStream());
        out=new DataOutputStream(socket.getOutputStream());
      }
   catch (IOException ee)
      { 
       tishi.setText("连接失败");
      }
   if(socket!=null)
      {
        InetAddress address=socket.getInetAddress();
        tishi.setText("连接:"+address+"成功");
      } 
   if(thread==null)
      {
        thread=new Thread(this);
        thread.start();
      }
		}
	
	public void run(){
		String s=null;
	    while(true)
	     { 
	       try{
	             s=in.readUTF();
	            
	          }
	        catch (IOException e)
	          {
	            tishi.setText("与服务器已断开");
	            break;
	          }
	     xianshi.setText("删除成功");
	    }

		}
	//..........
	public void actionPerformed(ActionEvent e)
	 {
	   if(e.getSource()==btn_add)
	     { 
	       String s1="";
	       String tianjia=btn_add.getLabel();//有写的
	      
	       s1=txt_no.getText();	      
	       String str=s1;      
	       if(str.length()>0)		      
	        { 
	          try{
	              out.writeUTF(str);
	             }
	          catch(IOException e1)
	             {
	              tishi.setText("与服务器已断开");
	             } 
	        } 
	       else
	        {
	       	xianshi.setText("删除成功");
	        }              
	       
	     }
	 }

	//............
		

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -