其中
另一個有用的緩沖組件是BufferedOutputStream
public BufferedOutputStream(OutputStream out)
public BufferedOutputStream(OutputStream out
第
此外
除了能夠改善I/O性能
public class NoBufferMovingCircle extends JApplet implements Runnable {
Image screenImage = null;
Thread thread;
int x =
int move =
public void init() {
screenImage = createImage(
}
public void start() {
if (thread == null) {
thread = new Thread(this)
thread
}
}
public void run() {
try {
while (true)
{
x += move;
if ((x >
move *=
repaint()
Thread
}
} catch (Exception e) {
}
}
public void drawCircle(Graphics gc) {
Graphics
g
g
g
g
}
public void paint(Graphics g) { //畫一個圓
g
g
drawCircle(g)
}
}
以上代碼沒有main()函數
[
From:http://tw.wingwit.com/Article/program/Java/gj/201311/27805.html