62,620
社区成员
发帖
与我相关
我的任务
分享package c_port_packageBJTeacher;
import java.awt.Dialog;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.util.ArrayList;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
//创建ChatClient类作为聊天窗口;
public class Complete_ChatForeUITeacherClient extends AFrame implements WindowListener,KeyListener,ItemListener, ActionListener
{
ArrayList<ActionListener> netlistenerbox = new ArrayList<ActionListener>();
ArrayList<ActionListener> locallistenerbox = new ArrayList<ActionListener>();
CaptureScreen cjco = null;
int lennum = 0;
boolean MythisOrderNumvalue = false;//为“true值”,是“已经款项付讫”.为“false值”,是“尚未付款”的状态.
TcpSend cjco0 = null;
int MyVisiblestate = 1;
ActionListener netfuct1Item,netfuct2Item,netfuct3Item,netfuct4Item,netfuct5Item,netfuct6Item,netfuct7Item,netfuct8Item = null;
ActionListener localfuct1Item,localfuct2Item,localfuct3Item,localfuct4Item,localfuct5Item =null;
String SendInfo = "";
public String MyFriendIP = "";
String MyURLLocal = "";
String MyChatingFriUID = "好友坐席";
JLabel jL0 = new JLabel("未付款");
private static final long serialVersionUID = 1L;
static Integer ChatPartnerSerialMark = 200;
Integer ChatFriNum = 200;
JScrollPane jspanel0 = null;
JScrollPane jspanel1 = null;
static DataOutputStream dops3 = null;
JPanel jp = new JPanel();
static DataInputStream dips3 = null;
boolean started = false;
InetAddress addr = null;
String title = "获取好友资料";
String chatword = null;
Dialog ordernum = new Dialog(this,title,started);
String str;
int T =0;
String[] netfuctitem = new String[]{"测试功能0","测试功能1","测试功能2","测试功能3","测试功能4","测试功能5","测试功能6","测试功能7"};
String[] localfuctitem = new String[]{"测试功能8","测试功能9","测试功能10","测试功能11","测试功能12"};
JMenuBar myclientMenuBar = new JMenuBar();
JMenu netfuct = new JMenu("网络功能");
JMenu localfuct = new JMenu("本地功能");
public static String UIDLocal = null;
static String roleLocal = null;
static String iPAddressLocal = null;
String Local_Teacher_facia = null;
Integer MyIndex = -1;
public String MyChatObjrolE = null;
JPanel jp1 = new JPanel();
String MyFriRoleCh = "";
public JTextArea writeMyChatwordTextArea = new JTextArea();
String TeacherFuct = null;
public JTextArea showMyChatwordTextArea = new JTextArea();
OutputStream outputstream = null;
int Localmyvaluenum = 0;
byte LocalMyMemGrade = 0;
//CaptureScreen capScreen = new CaptureScreen();
public Complete_ChatForeUITeacherClient(String URL,Integer MyNum,String User_facia,final Integer ChatObjectNum,final String ChatObjrolE,String MyFriIP,byte MyMemGrade){
this.setTitle(User_facia);
this.setBounds(new Rectangle(419,92,590,550));
MyURLLocal = URL;
MyIndex = MyNum;
roleLocal = "Mem";
ChatPartnerSerialMark = ChatObjectNum;
//////System.out.println("CJ!!加油!!最牛逼伟望特必!!"+ChatObjectNum);
MyChatObjrolE = ChatObjrolE;
LocalMyMemGrade = MyMemGrade;
if(MyChatObjrolE.equals("Mem")){
MyFriRoleCh = "教师";
}else{
MyFriRoleCh = "学生";
}
MyFriendIP = MyFriIP;
iPAddressLocal = GetMyLocalIP.catchLocalIP();
//TODO:
writeMyChatwordTextArea.addKeyListener(this);
showMyChatwordTextArea.setLineWrap(true);
showMyChatwordTextArea.setEditable(false);
jspanel0=new JScrollPane(showMyChatwordTextArea);
jspanel1 = new JScrollPane(writeMyChatwordTextArea);
jspanel0.setBounds (new Rectangle (10,50,500,220));
jspanel1.setBounds (new Rectangle (10,280,500,220));
jL0.setBounds(new Rectangle(233,230,97,50));
jspanel0.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
jspanel0.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jspanel1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jp1.setLayout(null);
showMyChatwordTextArea.setLineWrap(true);
writeMyChatwordTextArea.setLineWrap(true);
writeMyChatwordTextArea.setWrapStyleWord(true);
showMyChatwordTextArea.setWrapStyleWord(true);
jp1.setBounds(new Rectangle(10,10,590,550));
jp1.add(jspanel0);
jp1.add(jL0);
jp1.add(jspanel1);
setVisible(true);
this.addWindowListener(this);
netfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
netlistenerbox.add(netfuct1Item);
netfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
netlistenerbox.add(netfuct2Item);
netfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
netlistenerbox.add(netfuct3Item);
netfuct4Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
};
netlistenerbox.add(netfuct4Item);
netfuct5Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
netlistenerbox.add(netfuct5Item);
netfuct6Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
netlistenerbox.add(netfuct6Item);
netfuct7Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
netlistenerbox.add(netfuct7Item);
netfuct8Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
netlistenerbox.add(netfuct8Item);
localfuct1Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
locallistenerbox.add(localfuct1Item);
localfuct2Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
locallistenerbox.add(localfuct2Item);
localfuct3Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
locallistenerbox.add(localfuct3Item);
localfuct4Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
locallistenerbox.add(localfuct4Item);
localfuct5Item = new ActionListener() {
public void actionPerformed(ActionEvent event) {
}
};
locallistenerbox.add(localfuct5Item);
for(int i =0;i<8;i++){
JMenuItem netfuctsubitem = new JMenuItem(netfuctitem[i]);
netfuctsubitem.addActionListener(netlistenerbox.get(i));
netfuct.add(netfuctsubitem);
}
for(int i =0;i<5;i++){
JMenuItem localfuctsubitem = new JMenuItem(localfuctitem[i]);
localfuctsubitem.addActionListener(locallistenerbox.get(i));
localfuct.add(localfuctsubitem);
}
myclientMenuBar.add(netfuct);
myclientMenuBar.add(localfuct);
this.add(myclientMenuBar);
}
public void setMyJL0(boolean bool){
if(bool==true){
jL0.setText("<html>已付款</html>");
}else{
jL0.setText("<html>未付款</html>");
}
}
public void start() {
this.add(jspanel0);
this.add(jspanel1);
this.add(jp1);
jp1.setVisible(true);
this.setVisible(true);
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
}
@Override
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
this.setVisible(false);
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
public static void main(String[] args){
new Complete_ChatForeUITeacherClient("www.baidu.com",0,"CJCO!!加油!!",2,"Mem","222.196.1.8",(byte)1).start();
}
public void Ihavepayformyrequire(boolean bool){
MythisOrderNumvalue = bool;
}
@Override
public void windowOpened(WindowEvent e)
{
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
public void changeTitle(String ficia){
this.setTitle(ficia);
}
@Override
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
}
public void sendInfo(String Info){
}
@Override
public void keyReleased(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
@Override
public void itemStateChanged(ItemEvent arg0) {
// TODO Auto-generated method stub
}
}
public void start() {
this.add(jspanel0);
this.add(jspanel1);
this.add(myclientMenuBar);
this.add(jp1);
jp1.setVisible(true);
this.setVisible(true);
}