易截截图软件、单文件、免安装、纯绿色、仅160KB

java简单聊天室

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;
public class Applet1 extends Applet implements ActionListener,ItemListener
{
  TextArea mainText;
    JTextField input;
    JButton sendButton,disconnectButton,connectButton;
    Checkbox secretCheck;
    Choice objChoice;
 String name="大家";
 public void init()
   { 
   mainText=new TextArea("",10,15);
  
  
      input=new  JTextField("",40);
      sendButton=new JButton("发送");
      sendButton.setForeground(Color.blue);
     
      disconnectButton=new JButton("断开连接");
      disconnectButton.setForeground(Color.blue);
      connectButton=new JButton("连接主机");
      connectButton.setForeground(Color.blue);
      secretCheck=new Checkbox("密谈");
      objChoice=new Choice();
   objChoice.add("大家");
      objChoice.add("little girl");
      objChoice.add("boy");
    this.setBackground(new Color(200,210,50));
    add(new ChatPanel());
 sendButton.addActionListener(this);
 objChoice.addItemListener(this);
   }
   public void actionPerformed(ActionEvent e)
 {
      
    mainText.append("你对"+name+"说:"+input.getText()+"\n");
    input.setText("");
    
       
 }
   public void itemStateChanged(ItemEvent e)
 {
       name=(String)e.getItem();
 }
class ChatPa


相关文档:

JAVA收集

1.vector是线程同步的,所以它也是线程安全的,而arraylist是线程异步的,是不安全的。如果不考虑到线程的安全因素,一般用arraylist效率比较高。 2.如果集合中的元素的数目大于目前集合数组的长度时,vector增长率为目前数组长度的100%,而arraylist增长率为目前数组长度的50%.如过在集合中使用数据量比较大的数据,用vecto ......

我的java学习日记

   load-on-startup元素一般是配合servlet的配置使用的,load-on-startup 元素在web应用启动的时候指定了servlet被加载的顺序,它的值必须是一个整数。如果它的值是一个负整数或是这个元素不存在,那么容器会在该servlet被调用的时候,加载这个servlet 。如果值是正整数或零,容器在配置的时候就加载并初始化 ......

使用EditPlus配置Java编译环境

初学者更适合使用文本编辑软件来学习Java,对Java有一定认识后推荐使用Eclipse,对那些要求开发效率的程序员当然首选就是JBuilder。
         对于文本编辑软件我推荐EditPlus,EditPlus是很多程序员非常熟悉的编辑工具,它以占用系统资
源小、操作简便灵活、支持文件类型丰富 ......

Java中HashMap使用自定义Key类

自定义的Key类需要重载equals, hashCode函数。。 
package com.albert.test;
import java.util.Vector;
import java.util.HashMap;
/**
* @author tough_guy
*
*/
//对于自定义的key, 需要重载hashCode函数和equals函数
class IPSegment
{
long ip_s;
long ip_e;
int p;
IPSegment Reset(long f ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号