改め Objective Technician

はぐれ技術者のやりたい放題

ソース終盤

2007-11-02 16:26:06 | プログラミング

class MyPanel extends Panel implements AdjustmentListener{

	Button button[] = new Button[3];
	MyUniverse un = null;
	MyBranchGroup bg = null;
	MyMouse mouse = null;

	TextField dpf_file = null;
	Label lbl[] = new Label[9];
	Checkbox chk[] = new Checkbox[3];
	Scrollbar sb[] = new Scrollbar[8];

	static Label currnt = null;

	Label nulls[] = new Label[10];


	public void adjustmentValueChanged(AdjustmentEvent e){

		if(e.getSource().equals(sb[0])){
			Parameters.pm_radius = (float)e.getValue()/1000.0f;
			lbl[1].setText("PM平均半径" + Parameters.pm_radius + "[μm]");
		}

		else if(e.getSource().equals(sb[1])){
			Parameters.pm_radius_sigma = (float)e.getValue()/1000.0f;
			lbl[2].setText("PM半径標準偏差" + Parameters.pm_radius_sigma + "[μm]");
		}

		else if(e.getSource().equals(sb[2])){
			Parameters.pm_flow = (float)e.getValue()/1000.0f;
			lbl[3].setText("PM流れ速度" + Parameters.pm_flow + "[μm/s]");
		}

		else if(e.getSource().equals(sb[3])){
			Parameters.pm_burn = (float)e.getValue()/1000.0f;
			lbl[4].setText("PM燃焼速度" + Parameters.pm_burn + "[μm/s]");
		}

		else if(e.getSource().equals(sb[4])){
			Parameters.pm_generate_num = (float)e.getValue();
			lbl[5].setText("PM発生速度" + (int)Parameters.pm_generate_num + "[個/s]");
		}


		else if(e.getSource().equals(sb[5])){
			Parameters.step = (float)e.getValue();
			lbl[6].setText("計算時間間隔" + Parameters.step + "[step/s]");
		}
		
		else if(e.getSource().equals(sb[6])){
			Parameters.exe_speed = e.getValue();
			lbl[7].setText("実行速度" + Parameters.exe_speed + "[倍]");
		}
		
		else if(e.getSource().equals(sb[7])){
			Parameters.pm_diffuse = (float)e.getValue()/1000.0f;
			lbl[8].setText("拡散速度" + Parameters.pm_diffuse + "[μm/s]");
		}
		
		
		Parameters.pm_init(false);
		
	}

	public MyPanel(MyUniverse un, MyBranchGroup bg, MyMouse mouse){
		this.un = un;
		this.bg = bg;
		this.mouse = mouse;

		setLayout(new GridLayout(3, 5));

		String[] label = {"計算開始", "計算中止", "計算再開", "一時停止", "PM平均半径[μm]", "PM半径標準偏差[μm]", "流れ速度[μm/s]", "拡散速度[μm/s]"
				, "DPFファイル名", "PM燃焼速度[μm/s]", "PM発生速度[個/s]", "計算時間間隔[step/s]", "DPF非表示", "DPF表示", 
				"PM表示", "PM非表示", "座標軸表示", "座標軸非表示", "アニメーション速度x[倍]", "計算終了時間[s]", "ポジション復帰"};

		MyActionListener listener = new MyActionListener();

		button[0] = new Button("計算開始");
		button[1] = new Button("DPF読み込み");
		button[2] = new Button("ポジション復帰");

		lbl[0] = new Label("DPFモデルファイル:");
		add(lbl[0]);

		dpf_file = new TextField("SiC_IVE_ascii.stl");
		add(dpf_file);
		dpf_file.addActionListener(listener);

		add(button[1]);
		button[1].addActionListener(listener);

		lbl[1] = new Label("PM平均半径" + Parameters.pm_radius + "[μm]");
		add(lbl[1]);
		sb[0] = new Scrollbar(Scrollbar.HORIZONTAL, 5000, 5, 500, 15000);
		add(sb[0]);

		lbl[2] = new Label("PM半径標準偏差" + Parameters.pm_radius_sigma + "[μm]");
		add(lbl[2]);
		sb[1] = new Scrollbar(Scrollbar.HORIZONTAL, 1000, 5, 0, 5000);
		add(sb[1]);

		lbl[3] = new Label("PM流れ速度" + Parameters.pm_flow + "[μm/s]");
		add(lbl[3]);
		sb[2] = new Scrollbar(Scrollbar.HORIZONTAL, 1000, 5, 0, 10000);
		add(sb[2]);
		
		nulls[0] = new Label();
		add(nulls[0]);
		

		lbl[8] = new Label("拡散速度" + Parameters.pm_diffuse + "[μm/s]");
		add(lbl[8]);
		sb[7] = new Scrollbar(Scrollbar.HORIZONTAL, 1000, 5, 0, 20000);
		add(sb[7]);


		lbl[4] = new Label("PM燃焼速度" + Parameters.pm_burn + "[μm/s]");
		add(lbl[4]);
		sb[3] = new Scrollbar(Scrollbar.HORIZONTAL, 1000, 5, 0, 15000);
		add(sb[3]);

		lbl[5] = new Label("PM発生速度" + Parameters.pm_generate_num + "[個/s]");
		add(lbl[5]);
		sb[4] = new Scrollbar(Scrollbar.HORIZONTAL, 3, 5, 0, 20);
		add(sb[4]);

		lbl[6] = new Label("計算時間間隔" + Parameters.step + "[step/s]");
		add(lbl[6]);
		sb[5] = new Scrollbar(Scrollbar.HORIZONTAL, 1, 5, 1, 10);
		add(sb[5]);

		lbl[7] = new Label("実行速度" + Parameters.exe_speed + "[倍]");
		add(lbl[7]);
		sb[6] = new Scrollbar(Scrollbar.HORIZONTAL, 1, 5, 1, 20);
		add(sb[6]);

		for(int i = 0; i <7; i++)