import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.swing.*;
import java.awt.*;
public class CustomerApplet extends JApplet implements Runnable
{
JPanel panelObject;
JLabel labelAnimation;
String dealerInfo[]={"Cellsoft,Inc-免费1年服务",
"SpeakCorp-新手机10%折扣",
"TalkWorld,Inc-Buy和win奖金"};
int counter;
Thread t1;
public void init()
{
labelAnimation=new JLabel(" ");
panelObject=new JPanel();
panelObject=(JPanel)getContentPane();
panelObject.setLayout(new FlowLayout());
panelObject.add(labelAnimation);
t1= new Thread(this);
t1.start(); //启动线程
}
public void run() // 线程的主体
{
for(;;)
{
display();// 这个方法显示数据
try
{
t1.sleep(1500);
}
catch(InterruptedException e)
{
showStatus("Thread interrupted");
}
}
}
public void display() //显示
{
Font f=new Font("Times New Roman",Font.BOLD,38);
labelAnimation.setText(dealerInfo[counter]);
counter++;
if(counter>=3)
counter=0;
}
}
这个程序可以让那三句话一个一个循环的显示出来,怎样才能让三幅图片像这样显示呢?
请高手指教指教,谢谢!!!