1

重複の可能性:
Java Swing のマーキー効果

マーキー効果を取得しようとしています (html と同じ)。しかし、私はこのコードではそうすることができません。マーキー効果を得るためにこのコードを改善するにはどうすればよいですか?

import java.awt.event.*;
import javax.swing.*;
import java.awt.*;

class tester {
JLabel l;

tester() {
JFrame fr=new JFrame();
JPanel p=new JPanel();
l=new JLabel("");
fr.add(p);
p.add(l);
fr.setVisible(true);
fr.setSize(400,400);
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void MarqueeEffect() {
  ActionListener ac = new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
      l.setText("To action alone hast thou a right and never at all to its fruits let not the   fruits of action be thy motive; neither let there be in thee any attachment to inaction");
    }
  };
  new Timer(2000,ac).start();
}

public static void main(String args[]) {
  tester t=new tester();
  t.MarqueeEffect();
 }
}
4

1 に答える 1