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

📄 speaking.java

📁 java 数据库编程实例 经过反复调试 保证可以运行 是学习java网络编程的绝佳资料
💻 JAVA
字号:
package chatroom;
import java.util.*;

/**
 * Title:        JSP聊天室
 * Description:  Java语言演示程序:JSP聊天室,用于北京师范大学计算机系Java课程教学示范。
 * Copyright:    Copyright (c) 2002
 * Company:      北京师范大学计算中心
 * @author 张庆利
 * @version 1.0
 */

public class speaking{
   String mySpeaking;
   String sourceUserId;
   String targetUserId;
   String sourceUserName;
   String targetUserName;
   String face;
   String color;
   String radprivate;
   public void setSpeaking(String theSpeaking,String theSourceUserId,String theTargetUserId,String theSourceUserName,String theTargetUserName,String theFace,String theColor,String theRadprivate){
      mySpeaking=theSpeaking;
      sourceUserId=theSourceUserId;
      targetUserId=theTargetUserId;
      sourceUserName=theSourceUserName;
      targetUserName=theTargetUserName;
      face=theFace;
      color=theColor;
      radprivate=theRadprivate;
   }
   public String returnSpeaking(String thisUserId){
      String thisSpeaking=new String("");
      if (radprivate.equals("system")){
         if (color.equals("red"))
            thisSpeaking="<font size=2 color=red>(公告)"+sourceUserName+"进入聊天室。</font><br>";
          else
             thisSpeaking="<font size=2 color=green>(公告)"+sourceUserName+"离开聊天室。</font><br>";
      }
      else{
        if ((!radprivate.equals("yes")) || (targetUserId.equals(thisUserId)) || (sourceUserId.equals(thisUserId))){
          if (targetUserId.equals("all"))
            thisSpeaking="<font size=2 color="+color+">"+sourceUserName+"对大家"+returnFace(face)+"说:"+mySpeaking+"</font><br>";
          else
            thisSpeaking="<font size=2 color="+color+">"+sourceUserName+"对"+targetUserName+returnFace(face)+"说:"+mySpeaking+"</font><br>";
        }
      }
      return thisSpeaking;
  }
  public String returnFace(String theFace){
     int nn;
     nn=Integer.parseInt(theFace);
     String thisFace=new String("");
     switch (nn){
        case 1:thisFace="无";break;
        case 2:thisFace="笑";break;
     }
     return thisFace;
   }
}

⌨️ 快捷键说明

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