抛物线java代码 抛物线快捷公式( 三 )


LogOut.out(this, "isShowMovie:" + parabolaView.isShowMovie());
if (parabolaView.isShowMovie() == false) {
number++;
enableRefresh = true;
parabolaView.setIcon(BitmapFactory.decodeResource(getResources(), R.drawable.icon));
// 设置起始Y轴高度和终止X轴位移
parabolaView.setParams(200, ((ViewGroup) txtNumber.getParent()).getLeft());
parabolaView.showMovie();
}
}
}
public void onParabolaStart(ParabolaView view) {
}
public void onParabolaEnd(ParabolaView view) {
handler.sendEmptyMessage(REFRESH_TEXTVIEW);
}
public boolean handleMessage(Message msg) {
switch (msg.what) {
case REFRESH_TEXTVIEW:
if (txtNumber.getVisibility() != View.VISIBLE) {
txtNumber.setVisibility(View.VISIBLE);
}
RotateAnimation anim = new RotateAnimation(txtNumber.getWidth()1, txtNumber.getHeight()1,
RotateAnimation.ROTATE_INCREASE);
anim.setInterpolatedTimeListener(this);
txtNumber.startAnimation(anim);
break;
}
return false;
}
@Override
public void interpolatedTime(float interpolatedTime) {
// 监听到翻转进度过半时,更新txtNumber显示内容 。
if (enableRefreshinterpolatedTime0.5f) {
txtNumber.setText(Integer.toString(number));
// Log.d("ANDROID_LAB", "setNumber:" + number);
enableRefresh = false;
}
}
}
java一个小圆球抛物线运动 , 请问抛物线的运动怎么实现?1、首先描一个坐标轴
2、确定方程式
3、打点
4、连线
5、取出打点的坐标,按照顺序依次变更颜色(做出运动效果)
6、简单的一元二次方程举例【步骤5留给题主思考】
public class View extends JFrame {
public View() {
JFrame frame = new JFrame("Equation");
frame.getContentPane().setLayout(new BorderLayout());
JPanel panel1 = new JPanel();
panel1.setPreferredSize(new Dimension(50, 50));
JLabel labelA = new JLabel();
labelA.setText("a");
JTextField textA = new JTextField("0",3);
JLabel labelB = new JLabel();
labelB.setText("b");
JTextField textB = new JTextField("0",3);
JLabel labelC = new JLabel();
labelC.setText("c");
JTextField textC = new JTextField("0",3);
JButton draw = new JButton();
draw.setText("Draw");
draw.addActionListener( new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
Controller.a = Double.parseDouble(textA.getText());
Controller.b = Double.parseDouble(textB.getText());
Controller.c = Double.parseDouble(textC.getText());
repaint();
frame.pack();
frame.setSize(420,490);
}
});
panel1.add(labelA);
panel1.add(textA);
panel1.add(labelB);
panel1.add(textB);
panel1.add(labelC);
panel1.add(textC);
panel1.add(draw);
JPanel panel2 = new JPanel(){
public void paint(Graphics g){
super.paint(g);
Controller.grid(g);
Controller.Graphic1(g);
}
};
panel2.setBackground(Color.WHITE);
frame.getContentPane().add(panel1, BorderLayout.PAGE_START);
frame.getContentPane().add(panel2, BorderLayout.CENTER);
frame.setVisible(true);
frame.setSize(420,490);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
View frame = new View();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
public class Controller {
static double a=2, b=1, c=0;
public static void grid (Graphics g){
g.setColor(Color.blue);
g.drawLine(200,0,200,400);
g.drawLine(0,200,400,200);
for (int x=0; x=400; x= x +40){
g.drawLine(x,195,x,205);

推荐阅读