chesspcname.java

来自「<Java编程精选集锦>随书源码」· Java 代码 · 共 34 行

JAVA
34
字号
import java.awt.*;
import chessArray;
import java .awt.event .* ;

public class chessPcName extends Dialog implements ActionListener 
{
	TextField td=new TextField ("",30);
	Label lb=new Label ("请输入庄家电脑名称:");
	Button bt=new Button ("确定");
	public chessPcName(Frame frbak) 
	{
		super(frbak,"获取庄家名称",true);
		setBackground(Color.cyan);
		int width=200;
		int height=200;
		this.add("North",lb);
		this.add("Center",td);
		bt.addActionListener (this);
		this.add("South",bt);
		setFont(new Font("chequer",Font.BOLD,16));
		setBounds(chessArray.offsize.width/2-width/2,chessArray.offsize.height/2-height/2,width,height);
		show();
	}
	public void actionPerformed(ActionEvent e)
	{
		chessClient chCe= new chessClient (td.getText ());
		chessArray.information("您是挑战者,不能先走棋");
		chessArray.readyIn=true;//挑战者只能先接受数据
		chessArray.change =false;//挑战者不允许先走棋
		chCe.start ();
		this.dispose ();
	}
}

⌨️ 快捷键说明

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