⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 virturalshocktube.txt

📁 流管中流体震荡模拟
💻 TXT
📖 第 1 页 / 共 2 页
字号:
/*    This class is a basic extension of the Frame class.  It can be used    by an applet or application.  To use it, create a reference to the class,    then instantiate an object of the class, and call the show() method.    example:    main themain;    themain = new main();    themain.show();    You can add controls or menus to main with Cafe Studio. */import java.awt.*;public class main extends Frame implements Runnable{    /* Tube Dimensions */    int xtube=275,ytube=30,ltube=400,htube=65,xdiap=200,yaxis=150;    double w,up,tubeLength=4;    double[] ue=new double[21];    double[] upe=new double[21];    Thread animator=null;    /* Screen Variables */    Image offi;    Graphics offg,gs;    public main() {        super("main window");        setBackground(Color.white);        //{{INIT_CONTROLS        setLayout(new BorderLayout());        addNotify();        resize(insets().left + insets().right + 700, insets().top + insets().bottom + 383);        choice1= new Choice();        choice1.setFont(new Font("Dialog",Font.PLAIN,10));        add(choice1);        choice1.reshape(insets().left + 58,insets().top + 46,119,24);        choice1.addItem("Air");        choice1.addItem("Carbon Dioxide");        choice1.addItem("Helium");        scrollbar1= new Scrollbar(Scrollbar.HORIZONTAL, 550,100,101,1000);        add(scrollbar1);        scrollbar1.reshape(insets().left + 58,insets().top + 88,119,16);        scrollbar2= new Scrollbar(Scrollbar.HORIZONTAL, 600,100,300,900);        add(scrollbar2);        scrollbar2.reshape(insets().left + 58,insets().top + 119,119,16);        choice2= new Choice();        choice2.setFont(new Font("Dialog",Font.PLAIN,10));        add(choice2);        choice2.reshape(insets().left + 58,insets().top + 171,119,24);        choice2.addItem("Air");        choice2.addItem("Carbon Dioxide");        choice2.addItem("Helium");        scrollbar3= new Scrollbar(Scrollbar.HORIZONTAL, 50,10,1,99);        add(scrollbar3);        scrollbar3.reshape(insets().left + 58,insets().top + 239,119,16);        scrollbar4= new Scrollbar(Scrollbar.HORIZONTAL, 50,10,1,99);        add(scrollbar4);        scrollbar4.reshape(insets().left + 58,insets().top + 271,119,16);        label1=new Label("Driver Gas");        label1.setFont(new Font("Dialog",Font.BOLD,12));        add(label1);        label1.reshape(insets().left + 32,insets().top + 13,91,18);        label2=new Label("Driven Gas");        label2.setFont(new Font("Dialog",Font.BOLD,12));        add(label2);        label2.reshape(insets().left + 32,insets().top + 137,91,17);        label3=new Label("Pressure = 550KPa");        label3.setFont(new Font("Dialog",Font.PLAIN,10));        add(label3);        label3.reshape(insets().left + 42,insets().top + 72,128,13);        label4=new Label("Pressure ratio = 0.50");        label4.setFont(new Font("Dialog",Font.PLAIN,10));        add(label4);        label4.reshape(insets().left + 42,insets().top + 223,140,14);        label5=new Label("Temperature  = 600K");        label5.setFont(new Font("Dialog",Font.PLAIN,10));        add(label5);        label5.reshape(insets().left + 42,insets().top + 106,123,9);        label6=new Label("Diaphragm");        label6.setFont(new Font("Dialog",Font.BOLD,12));        add(label6);        label6.reshape(insets().left + 32,insets().top + 205,85,18);        label7=new Label("Temperature ratio = 0.50");        label7.setFont(new Font("Dialog",Font.PLAIN,10));        add(label7);        label7.reshape(insets().left + 42,insets().top + 257,154,13);        label9=new Label("Type");        label9.setFont(new Font("Dialog",Font.PLAIN,10));        add(label9);        label9.reshape(insets().left + 42,insets().top + 156,75,13);        label10=new Label("Type");        label10.setFont(new Font("Dialog",Font.PLAIN,10));        add(label10);        label10.reshape(insets().left + 42,insets().top + 31,75,13);        button1=new Button("<<<<  FIRE  >>>>");        add(button1);        button1.reshape(insets().left + 58,insets().top + 302,119,23);        lcontact=new Label("");        lcontact.setFont(new Font("Dialog",Font.PLAIN,10));        add(lcontact);        lcontact.reshape(insets().left + 309,insets().top + 327,154,13);        lshock=new Label("");        lshock.setFont(new Font("Dialog",Font.PLAIN,10));        add(lshock);        lshock.reshape(insets().left + 309,insets().top + 310,154,13);        lexte=new Label("");        lexte.setFont(new Font("Dialog",Font.PLAIN,10));        add(lexte);        lexte.reshape(insets().left + 472,insets().top + 327,154,13);        lexple=new Label("");        lexple.setFont(new Font("Dialog",Font.PLAIN,10));        add(lexple);        lexple.reshape(insets().left + 472,insets().top + 310,154,13);        ltime=new Label("");        ltime.setFont(new Font("Helvetica",Font.BOLD,12));        add(ltime);        ltime.reshape(insets().left + 32,insets().top + 335,180,13);        lsstrength=new Label("");        lsstrength.setFont(new Font("Dialog",Font.PLAIN,10));        add(lsstrength);        lsstrength.reshape(insets().left + 309,insets().top + 344,154,13);        lestrength=new Label("");        lestrength.setFont(new Font("Dialog",Font.PLAIN,10));        add(lestrength);        lestrength.reshape(insets().left + 472,insets().top + 344,154,13);        //}}        offi=createImage(size().width,size().height);        offg=offi.getGraphics();        gs=this.getGraphics();        drawTube();        drawAxes();        //{{INIT_MENUS        //}}    }    public synchronized void show() {    	move(50, 50);    	super.show();    }    public boolean handleEvent(Event event) {     	if (event.target == scrollbar4) {    	    	scrollScrollbar4(event);    	    	return true;    	}    	else    	if (event.target == scrollbar3) {    	    	scrollScrollbar3(event);    	    	return true;    	}    	else    	if (event.target == scrollbar2) {    	    	scrollScrollbar2(event);    	    	return true;    	}    	else    	if (event.target == scrollbar1) {    	    	scrollScrollbar1(event);    	    	return true;    	}    	else    	if (event.id == Event.ACTION_EVENT && event.target == button1) {    	    	clickedButton1();    	    	return true;    	}    	else    	if (event.id == Event.WINDOW_DESTROY) {    	    hide();    	    return true;    	}    	return super.handleEvent(event);    }    //{{DECLARE_MENUS    //}}    //{{DECLARE_CONTROLS    Choice choice1;    Scrollbar scrollbar1;    Scrollbar scrollbar2;    Choice choice2;    Scrollbar scrollbar3;    Scrollbar scrollbar4;    Label label1;    Label label2;    Label label3;    Label label4;    Label label5;    Label label6;    Label label7;    Label label9;    Label label10;    Button button1;    Label lcontact;    Label lshock;    Label lexte;    Label lexple;    Label ltime;    Label lsstrength;    Label lestrength;    //}}    public void scrollScrollbar1(Event ev) {        label3.setText("Pressure = "+scrollbar1.getValue()+"KPa");    }    public void scrollScrollbar2(Event ev) {        label5.setText("Temperature = "+scrollbar2.getValue()+"K");    }    public void scrollScrollbar3(Event ev) {        if(scrollbar3.getValue()>9) label4.setText("Pressure ratio = 0."+scrollbar3.getValue());

⌨️ 快捷键说明

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