ユーザーが入力した文字列を表示するJavaアプレットを作成しようとしています。次に、その文字列と別の文字列を切り替えて文字列をフラッシュする必要があります。私はこれを行うためにスレッドを使用しようとしていますが、私はそれらとアプレットに不慣れであり、これから何をすべきかわかりません。
これが私がこれまでに持っているものです:
public class FlashingLabel extends JApplet implements Runnable
{
String blank;
String input;
JLabel label;
Thread t;
public void init()
{
input = JOptionPane.showInputDialog(null, "Enter String", "Flashing Label", JOptionPane.QUESTION_MESSAGE);
blank=" ";
t=new Thread(this);
t.start();
}
public void run()
{
while(true)
{
label=new JLabel(blank);
add(label);
this.repaint();
label=new JLabel(input);
add(label);
this.repaint();
}
}
}