国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

JavaC/Smode--Client

2019-11-18 15:24:06
字體:
來源:轉載
供稿:網友

  作者:ludejun98
  
  import java.applet.*;
  import java.awt.*;
  import java.awt.event.*;
  import java.io.*;
  import java.net.*;
  //public String str;
  
  
  class javaclient extends Panel implements ActionListener
  {
  
  
  TextField tf;
  LudCanvas cv;
  Button b;
  
  LudPanel(LudCanvas cv)
  {
  this.cv = cv;
  
  tf = new TextField("ludejun",30);
  add(tf);
  
  b = new Button("退出");
  b.addActionListener(this);
  add(b);
  b = new Button("發送");
  b.addActionListener(this);
  add(b);
  }
  
  
  public str actionPerformed(ActionEvent ev)
  {
  String str = ev.getActionCommand();
  if( str.equals("退出") )
  {
  //tf.setText("This is my first button");
  System.exit(0);
  }
  else
  {
  str = tf.getText();
  tf.setText("開始檢測發送......");
  return str;
  
  }
  }
  
  
  
  
  public static void main(String args[])
  {
  String data;
  Socket Client;
  DataInputStream InputS;
  DataInputStream KeyS;
  PRintStream OutputS;
  
  Basic h = new Basic();
  
  int i = 0;
  
  
  try
  {
  Client = new Socket(args[0],600);
  InputS = new
  DataInputStream(Client.getInputStream());
  OutputS = new PrintStream(Client.getOutputStream());
  KeyS = new DataInputStream(System.in);
  }
  catch(IOException e)
  {
  System.out.println("Cannot Connect with Server");
  return;
  }
  
  try
  {
  while (i<5)
  {
  data = KeyS.readLine();
  OutputS.println(data);
  System.out.println("ECHO From Server:"+ InputS.readLine());
  i++;
  }
  }
  catch(IOException e)
  {
  System.out.println("IOException Happened");
  }
  
  try
  {
  System.out.println("Now will end this program");
  Client.close();
  }
  catch(IOException e)
  {
  System.out.println("system cannot close socket");
  }
  }
  }
  
  
  
  //@@@@@@@@@@@@@@@@@@@@@@@222
  
  
  
  class LudCanvas extends Canvas
  {
  public void paint(Graphics g)
  {
  Rectangle r = getBounds();
  g.setColor(Color.red);
  int panelHeight = 15;
  int b = 3;
  g.drawRect(b , b , r.width-b-b , r.height-b-b-panelHeight);
  int t = 10;
  g.drawRect(t , t , r.width-t-t , r.height-t-t-panelHeight);
  
  g.drawString("The first applet of mine", 120, 30);
  
  
  Image img = Toolkit.getDefaultToolkit().getImage("ie.gif");
  
  g.drawImage(img, 50, 50, this);
  
  
  }
  
  }
  
  
  class LudPanel extends Panel implements ActionListener
  {
  TextField tf;
  LudCanvas cv;
  Button b;
  
  LudPanel(LudCanvas cv)
  {
  this.cv = cv;
  
  tf = new TextField("ludejun",30);
  add(tf);
  
  b = new Button("退出");
  b.addActionListener(this);
  add(b);
  b = new Button("發送");
  b.addActionListener(this);
  add(b);
  }
  
  
  public void actionPerformed(ActionEvent ev)
  {
  String str = ev.getActionCommand();
  if( str.equals("退出") )
  {
  //tf.setText("This is my first button");
  System.exit(0);
  }
  else
  {
  tf.setText("開始檢測發送......");
  }
  }
  }
  :em51: :em51: :em51:

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 泰来县| 元阳县| 木里| 同仁县| 景洪市| 类乌齐县| 夹江县| 嘉兴市| 乌恰县| 科技| 浦城县| 济阳县| 土默特左旗| 忻州市| 松滋市| 沙湾县| 道孚县| 会理县| 嘉黎县| 南宁市| 南澳县| 虎林市| 祥云县| 海安县| 姚安县| 丹东市| 衡山县| 大港区| 黎平县| 伊宁县| 铁岭县| 涞源县| 永嘉县| 嘉定区| 寿宁县| 汉阴县| 枝江市| 墨脱县| 翼城县| 庆安县| 茌平县|