rebound.java
来自「java源程序 对初学者有很大的帮助 从简单到复杂」· Java 代码 · 共 42 行
JAVA
42 行
//********************************************************************
// Rebound.java Author: Lewis/Loftus
//
// Demonstrates an animation and the use of the Timer class.
//********************************************************************
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Rebound extends JApplet
{
private final int DELAY = 20;
private Timer timer;
//-----------------------------------------------------------------
// Sets up the applet, including the timer for the animation.
//-----------------------------------------------------------------
public void init()
{
timer = new Timer (DELAY, null);
getContentPane().add (new ReboundPanel(timer));
}
//-----------------------------------------------------------------
// Starts the animation when the applet is started.
//-----------------------------------------------------------------
public void start ()
{
timer.start();
}
//-----------------------------------------------------------------
// Stops the animation when the applet is stopped.
//-----------------------------------------------------------------
public void stop ()
{
timer.stop();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?