java小实验

package Second;
import java.awt.*;
import javax.swing.*;
import java.math.*;
import java.awt.event.*;
public class test1 implements ActionListener{

	/**
	 * @param args
	 */
	  public JTextField s=new JTextField(13);
	  public JTextField s1=new JTextField(13);
	  public JLabel l1=new JLabel("平方");
	  public JLabel l2=new JLabel("立方");
	  public JLabel l3=new JLabel(" 四次方");
	  public JButton b1=new JButton("平方结果");
	  public JButton b2=new JButton("立方结果");
	  public JButton b3=new JButton("四次方根");
	void display()
	{
	  
	  JPanel panel=new JPanel(new GridLayout(4,2));
	  JFrame jf=new JFrame("测试程序");
	  jf.setSize(300,200);
	  jf.setContentPane(panel);
	  jf.setVisible(true);
	  jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	  jf.setResizable(false);
	  panel.add(s);
	  panel.add(s1);
	  panel.add(l1);
	  panel.add(b1);
	  panel.add(l2);
	  panel.add(b2);
	  panel.add(l3);
	  panel.add(b3);
	  b1.addActionListener(this);
	  b2.addActionListener(this);
	  b3.addActionListener(this);
	}
	public void actionPerformed(ActionEvent e){
		
		if(e.getSource()==b1)
		{
		 double a=Double.parseDouble(s.getText());
		 a=a*a;
		 s1.setText(""+a);
		}
		else if(e.getSource()==b2)
		{
			 double a=Double.parseDouble(s.getText());
			 a=a*a*a;
			 s1.setText(""+a);
			
		}
		else if(e.getSource()==b3)
		{
			double a=Double.parseDouble(s.getText());
			a=a*a*a*a;
			s1.setText(""+a);
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
          test1 m=new test1();
          m.display();
	}

}

重庆大学11级计算机学院JAVA实验: Project 3:Raiden (雷電) Lite Overview Raiden (雷電,) is a 1990 scrolling shooter arcade game that was developed by Seibu Kaihatsu. The title in Japanese translates to "Thunder And Lightning". Rai means thunder, and den means lightning. "Raiden" is the name of a Japanese WWII Fighter. Raiden consists of eight vertical scrolling missions where the player pilots the "Raiden Supersonic Attack Fighter" through waves of enemies, dodging and destroying enemy buildings, ground targets, and air craft. For this project,you and your team will design and implement a simplified version of raiden game using Java language. Requirements Please read following specifications carefully. You will lose points if you miss any requirement.   The Player can control the Raiden by pressing different key on the keyboard. Four key are used to moving the fighter front, back, left and right respectively in order to avoid attacks of enemies or to target enemies. One key is used to fire a bullet or to launch a missile to attack enemies.   At least two types of weapon- bullet and missile should be supported. The bullet moves in straight line, and can only attack the enemy at front of it while the missile can target an enemy, track it and destroy it. After destroying an enemy aircraft the player can gain certain bonus such as making his weapons stronger, elongating his life or increasing score etc. When the player gained enough scores, the game should come into next stage, in which there are more enemies and the enemies shoot faster. At least two stages should be provided. Of course you can gain higher grade if you provide more advanced function beyond those listed above. Implement tips 1 You will find more useful informations in the following lessons: “Java GUI”, “Java Graphics”, “Applet and Multimedia”. The lesson ‘multithreading ’ maybe is useful to some advanced programmer.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值