チュートリアルで試せる内容

1)作成する処理ツールの仕様を確認して下さい

2)雛形のSample2.java を利用して,ツール作成の準備をします

	ソース
	コンストラクタ
	グローバル
	基本メソッド
	チェック
	README
	フォント+
	フォントー

3)ControlTest.java を編集し,プログラム作成の準備をします

コンストラクタの記述の修正

	public ControlTest()
	{
		setModuleID(9915);	// Set your module ID after you have got it
		pairingVisualizationID = new int[]{1};
		setToolType(2);
	}

4)一度コンパイルして,ControlTestツールの動作を確認します

5)ボタンの初期化をします

コンストラクタの前の,クラス内グローバル領域での変数の宣言

	JButton button[];
	int buttonNumber;
	String buttonNamesInJapanese[];

自動実行メソッド initializePanel() の作成(オーバーライド)

	public void initializePanel()
	{
		buttonNumber = 8;
		button = new JButton[buttonNumber];
			
		for(int i=0;i<buttonNumber;i++)
		{
			button[i] = new JButton();
			button[i].addActionListener(this);
			operationPanel.add(button[i]);
		}
	
		buttonNamesInJapanese = fileReadArray();
	}

自動実行メソッド initializeData() の作成(オーバーライド)

	public void initializeData()
	{
		String buttonNames[] = {"Source","Constructor","Global","Basic","Check","Readme","Font+","Font-"};
		
		if(isMenuInJapanese())
			for(int i=0;i<buttonNumber;i++)
				button[i].setText(buttonNamesInJapanese[i]);
		else
			for(int i=0;i<buttonNumber;i++)
				button[i].setText(buttonNames[i]);	
	}

6)コピー元の関数を修正します

MyMethod() メソッドを削除します

miningOperations()の記述を修正します

	public void miningOperations(int optionNumber)
	{
		switch(optionNumber)
		{
			case 0:
				resetData();
				setDataString(text.originalText);			
				break;
		}
	}

7)ボタンが押されたときの動作を記述します.

actionPerformed(ActionEvent e)メソッドに記述します

	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource() == button[0])
		{
			executeOtherModule(99999,0);
			displayOtherModule(1,0);			
		}
		if(e.getSource() == button[1])
		{
			executeOtherModule(99999,1);
			displayOtherModule(1,0);			
		}
		if(e.getSource() == button[2])
		{
			executeOtherModule(99999,2);
			displayOtherModule(1,0);
		}
		if(e.getSource() == button[3])
		{
			executeOtherModule(99999,3);
			displayOtherModule(1,0);			
		}
		if(e.getSource() == button[4])
		{
			executeOtherModule(99999,4);
			displayOtherModule(1,0);			
		}
		if(e.getSource() == button[5])
		{
			executeOtherModule(99999,5);
			displayOtherModule(1,0);			
		}
		if(e.getSource() == button[6])
		{
			displayOtherModule(1,10);
		}
		if(e.getSource() == button[7])
		{
			displayOtherModule(1,9);
		}
	}

7)コンパイルして動作を確認します


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS