frame.setSize(240,80);
JButton exit=new JButton(Exit);
frame.getContentPane().add(exit,BorderLayout.CENTER);
Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
Dimension a=frame.getSize();
frame.setLocation((screen.width-a.width)/2,(screen.height-a.height)/2);
one=new ServerTest();
one.start();
final ServerTest the=one;
exit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
the.close();
System.exit(0);
}
});
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
the.close();
System.exit(0);
}
});
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
one.close();
}
System.exit(0);
}
}
}
客户端源程序已经编写了,正在完善中。欢迎大家来信咨询,在我的主页已经公开源代码了!
//客户端源代码:
/*
* Created on 2003-3-25
*
* To change this generated comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
使用方法:
先在服务器运行服务器端程序
再在客户端运行客户端程序(不要运行在一台机器上,你会发现鼠标很奇怪)
在客户端右击中间区域,单击那个菜单项,输入服务器的地址
ok
让我继续来完善
*/