扑克牌 java代码
在论坛上面找到几个类似的代码,但是好像不能运行。如果有蜘蛛纸牌也可以,只要是扑克牌相关的java就可以啦。。。希望大家能给一个确切可以运行,尽量还附有些注释的代码吧。。谢谢大家啦。。
------最佳解决方案--------------------发牌程序
import java.awt.*;
import java.awt.event.*;
public class Card extends WindowAdapter
{
Frame f;
TextArea ta1,ta2,ta3,ta4;
public void display()
{
f = new Frame("Send Card");
f.setSize(400,300);
f.setLocation(200,140);
f.setBackground(Color.lightGray);
f.setLayout(new GridLayout(2,2));
f.addWindowListener(this);
ta1 = new TextArea("",5,10,3); //文本区没有滚动条
ta2 = new TextArea("",5,10,3);
ta3 = new TextArea("",5,10,3);
ta4 = new TextArea("",5,10,3);
Font font1 = new Font("Helvetica", Font.PLAIN, 20);
ta1.setFont(font1);
ta2.setFont(font1);
ta3.setFont(font1);
ta4.setFont(font1);
f.add(ta1);
f.add(ta2);
f.add(ta4);
f.add(ta3);
f.setVisible(true);
}
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
public static void main(String arg[])
{
Card p = new Card();
p.display();
Buffer3 bf = new Buffer3();
Sender3 s = new Sender3(bf,52);
s.start(); //启动发牌线程
s.setPriority(1); //设置最高优先级,值为1
Receiver3 r1=new Receiver3(bf,p.ta1); //创建四个取牌线程
Receiver3 r2=new Receiver3(bf,p.ta2);
Receiver3 r3=new Receiver3(bf,p.ta3);
Receiver3 r4=new Receiver3(bf,p.ta4);
r1.start(); //启动取牌线程,优先级为5