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

📄 elite.java

📁 j3me java
💻 JAVA
字号:
 import java.applet.*; import java.awt.*; import java.awt.event.*; import net.jscience.j3dme.*; import models.*;  public class Elite extends Applet implements ActionListener {  Image ctrlPanel;   public final static byte CAM_CTRL   = 0;   public final static byte MODEL_CTRL = 1;   private World world;   private ViewPort view;   private Camera cam1;   private Model[] models;   private byte state = CAM_CTRL;   private Model model;   private int mi;   private Graphics _g;Button controlMode;Button modelSelect;Label pitch;Label roll;Label yaw;Button pitchminus;Button pitchplus;Button rollminus;Button rollplus;Button yawminus;Button yawplus;Button controlsButton;Button modelButton;    public void init(){     setLayout(null);     ctrlPanel = getImage(getCodeBase(),"ctrl_panel.gif");      world = new World(2);     _g = getGraphics();     Renderer renderer = new net.jscience.j3dme.renderers.AWTRenderer(_g);      // View Port with border     cam1 = new Camera(world,144);     view = new ViewPort(renderer,cam1,7,8,145,76);     initModels();     view.renderScene();     roll=new Label("z");     roll.setBounds(0,143,23,15);     add(roll);     rollminus=new Button("-");     rollminus.setBounds(23,143,14,15);     rollminus.addActionListener(this);     add(rollminus);     rollplus=new Button("+");     rollplus.setBounds(37,143,15,15);     rollplus.addActionListener(this);     add(rollplus);     yaw=new Label("Yaw");     yaw.setBounds(52,143,23,15);     add(yaw);     yawminus=new Button("-");     yawminus.setBounds(75,143,15,15);     yawminus.addActionListener(this);     add(yawminus);     yawplus=new Button("+");     yawplus.setBounds(90,143,15,15);     yawplus.addActionListener(this);     add(yawplus);     pitch=new Label("Pitch");     pitch.setBounds(105,143,26,15);     add(pitch);     pitchminus=new Button("-");     pitchminus.setBounds(131,143,14,15);     pitchminus.addActionListener(this);     add(pitchminus);     pitchplus=new Button("+");     pitchplus.setBounds(145,143,14,15);     pitchplus.addActionListener(this);     add(pitchplus);     controlsButton=new Button("Control");     controlsButton.setBounds(0,160,50,15);     controlsButton.addActionListener(this);     add(controlsButton);     modelButton=new Button("Model");     modelButton.setBounds(50,160,40,15);     modelButton.addActionListener(this);     add(modelButton);     view.renderScene();   }    public void initModels(){     models = new Model[4];     models[0] = new Cobra();     models[1] = new Viper();     models[2] = new Mamba();     models[3] = new Krait();     models[0].z = 256;     models[1].z = 256;     models[2].z = 256;     models[3].z = 256;     mi = 0;     model = models[mi];     world.addModel(model); }public void actionPerformed(ActionEvent event)	{      Button clickedButton = (Button) event.getSource();		if (clickedButton == modelButton)            {			changeModel();            }		else if(state == CAM_CTRL){		if (clickedButton == rollplus)            {			cam1.z += 4;            }		else if (clickedButton == rollminus)                 {	            cam1.z -= 4;                  }		else if (clickedButton == yawplus)                 {	            cam1.yaw += 4;                  }		else if (clickedButton == yawminus)                 {	            cam1.yaw -= 4;                  }		else if (clickedButton == pitchplus)                 {	            cam1.pitch += 4;                  }		else if (clickedButton == pitchminus)                 {	            cam1.pitch -= 4;                  }		else if (clickedButton == controlsButton)                 {	            state=MODEL_CTRL;                  roll.setText("Roll");                 }		}            else if(state == MODEL_CTRL){		if (clickedButton == rollplus)            {			model.roll += 4;            }		else if (clickedButton == rollminus)                 {	            model.roll -= 4;                  }		else if (clickedButton == yawplus)                 {	            model.yaw += 4;                  }		else if (clickedButton == yawminus)                 {	            model.yaw -= 4;                  }		else if (clickedButton == pitchplus)                 {	            model.pitch += 4;                  }		else if (clickedButton == pitchminus)                 {	            model.pitch -= 4;                  }		else if (clickedButton == controlsButton)                 {	            state=CAM_CTRL;                  roll.setText("z");                 }            }            view.renderScene();	}    private void changeModel(){          world.removeModel(model);          mi = (mi + 1) & 3;          model = models[mi];          world.addModel(model);          view.renderScene();   }public void paint(Graphics g)	{     view.renderScene();     g.drawImage(ctrlPanel,7,92,this);	}} 

⌨️ 快捷键说明

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