0
세로 막대는 애플릿의 높이까지 채워야합니다. 상단에 도달하면 새 막대가 이전 옆에 채우기 시작합니다. 문제 : http://bayimg.com/DAEoeaagm채우기 막대 (진행률 막대) JApplet 페인트() 스레드()
IMG 그것은 어떻게해야 : http://bayimg.com/dAeOgAaGm
새로운 줄은 이전 paint()
/막대가 얼마나
IMG를 클리어 충전이 시작되면 코드 :
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;
public class fillingbar extends JApplet implements Runnable{
int shifting=0,filling=0;
public void init()
{
Thread t= new Thread(this);
t.start();
setSize(400,250);
}
public void paint(Graphics g)
{
super.paint(g);
g.setColor(Color.GREEN);
g.fillRect(shifting,getHeight()-filling,20,filling);
g.setColor(Color.BLACK);
g.drawRect(shifting, getHeight()-filling, 20, filling);
}
public void run()
{
while(true)
{
repaint();
try{
if(shifting<getWidth())
{
if(filling<getHeight())
filling+=10;
else {
shifting+=20;
filling=0;
}
}
Thread.sleep(50);
}catch(Exception E){
System.out.println("Exception caught");
}
}
}
}