01坦克大战

1.GUI(Graphics User Interface)图形用户界面         

  AWT(Abstract Window Toolkit)抽象窗口工具集

Component n. 组成部分,部件,成分

2.AWT中核心的是Component类和Container类,Container类继承于Component,但是Container是一类特殊的Component,它代表一种容器,可以盛装普通的Component.

3.匿名类:这种类只用于一个简单的事件处理,可能是只有一个方法待触发执行,没必要花大力气去写成一个完整的类,所以写一个短小精悍的匿名类能让代码更加简洁明了。

 //this是一个Frame类,这个匿名类用了关闭窗口
 //窗口监听加入一个类,现在加入一个匿名类,关闭窗口。
	this.addWindowListener(new WindowAdapter() 
	{
	
		public void windowClosing(WindowEvent e) 
		{
			System.exit(0);
		}
	});

4.Fills an oval bounded by the specified rectangle with the current color.  Oval椭圆,rectangle矩形

	public void paint(Graphics g)
	{
		Color c=g.getColor();
		g.setColor(Color.RED);
		g.fillOval(50, 50, 30, 30);
		//Fills an oval bounded by the specified rectangle 
		//with the current color.
		g.setColor(c);
		
	}

5.paint方法在Component类中,窗口重画是自动调用。

6.屏幕坐标:左上角是原点,x是横轴向右,y是竖轴向下。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值