📄 circlebumper.java
字号:
/*
* CircleBumper.java
*
* Created on 2008年5月11日, 下午8:34
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package gizmos;
import java.awt.geom.*;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import gizmoball_demo.*;
/**
* @author ICE
*/
/**
* The circleBumper gizmo.
* <br>
* A circular shape with diameter 1L
* <br>
* Trigger: generated whenever the ball hits it
* <br>
* Action: none
* <br>
* Coefficient of reflection: 1.0
* <br>
* Circular bumpers cannot be rotated.
*
* @specfield radius : real // Radius of the gizmo (in world coordinates)
*/
public class CircleBumper extends BasicGizmo{
private static final double COEFF_REFLECTION = 1.0;
private static int RADIUS=30;
private Color color = new Color(0, 255, 0);
private AnimationWindow win;
/** Creates a new instance of CircleBumper */
public CircleBumper(){}
public CircleBumper(AnimationWindow win,java.lang.String name,int x,int y)
{
this.win = win;
this.name=name;
this.x=x;
this.y=y;
}
public void draw(java.awt.Graphics2D g)
{
Ellipse2D ab = new Ellipse2D.Double(x,y,RADIUS,RADIUS);
g.setColor(color);
g.fill(ab);
}
public int getDis(){
return RADIUS;
}
//public org.w3c.dom.Element toXML(boolean compatible){}
//public int pollScore(){}
//public int popScore(){}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -