clientform.java

来自「这是一个Java编写的手机象棋游戏」· Java 代码 · 共 43 行

JAVA
43
字号
import javax.microedition.lcdui.*;

public class ClientForm extends Form implements CommandListener
{
	private Command		exit=null,ok=null;
	private MainSelect	mainSelect=null;
	private ChoiceGroup	saveChoice, musicChoice, soundChoice;
	private String		saveChoiceString[]={"不保存","保存"} ,musicChoiceString[] = {"打开","关闭"} ,soundChoiceString[] = {"打开","关闭"};
	
	public ClientForm(MainSelect ms)
	{
		super("打擂设置");
		mainSelect=ms;
		//*********界面初始化
		saveChoice=new ChoiceGroup("是否保存记录",Choice.EXCLUSIVE,saveChoiceString,null);
		musicChoice=new ChoiceGroup("背景音乐",Choice.EXCLUSIVE,musicChoiceString,null);
		soundChoice=new ChoiceGroup("走步提示",Choice.EXCLUSIVE,soundChoiceString,null);
		append(saveChoice);
		append(musicChoice);
		append(soundChoice);
		//*********命令初始化
		exit=new Command("Exit",Command.EXIT,1);
		ok=new Command("OK",Command.OK,1);
		addCommand(exit);
		addCommand(ok);
		setCommandListener(this);
	}

	public void commandAction(Command com,Displayable dis)
	{
		if(com==exit)
		{
			Chess.dis.setCurrent(mainSelect);
		}
		if(com==ok)
		{
			int saveIndex = saveChoice.getSelectedIndex();
			int	musicIndex=musicChoice.getSelectedIndex();
			int	soundIndex=soundChoice.getSelectedIndex();
			new ClientChess(mainSelect,saveIndex, musicIndex, soundIndex);
		}
	}
};

⌨️ 快捷键说明

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