Selve rulle metoden har jeg et eksampel på her:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
public class GK_About extends JFrame
{
JPanel p;
ImageIcon icon;
JLabel iconL,frank,ismar,lars,erol,dk;
Timer ta,ta2,ta3;
int x=38;
int y=500;
int fx=500;
int fy=150;
int ix=500;
int iy=200;
int lx=500;
int ly=250;
int ex=500;
int ey=300;
int dkx=-300;
int dky=400;
public GK_About()
{
javax.swing.UIManager.put("Label.font",new Font("Verdana",Font.PLAIN, 18));
p = new JPanel();
p.setLayout(null);
p.setBackground(Color.white);
p.setBorder(new LineBorder(Color.black));
icon = new ImageIcon("ikon/filegroup.gif");
iconL = new JLabel();
iconL.setBorder(new LineBorder(Color.black,3));
iconL.setIcon(icon);
iconL.setSize(425,96);
iconL.setLocation(x,y);
p.add(iconL);
frank = new JLabel("Frank Bille Jensen");
frank.setSize(250,20);
frank.setLocation(fx,fy);
p.add(frank);
ismar = new JLabel("Ismar Ramadanovic");
ismar.setSize(250,30);
ismar.setLocation(ix,iy);
p.add(ismar);
lars = new JLabel("Lars Mortensen");
lars.setSize(250,30);
lars.setLocation(lx,ly);
p.add(lars);
erol = new JLabel("Erol Eskici");
erol.setSize(250,30);
erol.setLocation(ex,ey);
p.add(erol);
dk = new JLabel("Besøg os på
www.FileGroup.dk");
dk.setSize(350,30);
dk.setLocation(ex,ey);
p.add(dk);
traad();
traad3();
getContentPane().add(p);
setBounds(300,100,500,500);
setUndecorated(true);
setVisible(true);
}
public void traad()
{
ta = new javax.swing.Timer(3, new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
iconL.setLocation(x,y--);
frank.setLocation(fx--,fy);
ismar.setLocation(ix--,iy);
lars.setLocation(lx--,ly);
erol.setLocation(ex--,ey);
if(y==40)
{
ta.stop();
traad2();
}
}
});
ta.start();
}
public void traad2()
{
ta2 = new javax.swing.Timer(3, new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
dk.setLocation(dkx++,dky);
if(dkx==110)
{
ta2.stop();
}
}
});
ta2.start();
}
public void traad3()
{
ta3 = new javax.swing.Timer(20000, new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
dispose();
}
});
ta3.start();
}
public static void main(String[] aslan)
{
new GK_About();
}
}