Na klar…
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.net.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
public class Test extends Applet implements ActionListener {
Image image_a,image_n,image,image1,image2,image3,image0;
URL path1,path2,path3;
ImageIcon starticon, stopicon;
URL pathx, pathstartbutton, pathstopbutton;
MediaTracker mt = new MediaTracker(this);
JButton startbutton, stopbutton1, stopbutton2;
public void init() {
try {
initialisieren();
}
catch (Exception e) {e.printStackTrace();}
}
public void initialisieren() throws Exception {
setLayout(null);
setSize(404,200);
pathx = new URL(getCodeBase(), „slotmaschine/images/start2.gif“);
pathstartbutton = new URL(getCodeBase(), „slotmaschine/images/start2.gif“);
starticon = new ImageIcon(pathstartbutton);
startbutton = new JButton(starticon);
pathstopbutton = new URL(getCodeBase(), „slotmaschine/images/stop_grau.gif“);
stopicon = new ImageIcon(pathstopbutton);
stopbutton1 = new JButton(stopicon);
stopbutton2 = new JButton(stopicon);
add(stopbutton1);
add(startbutton);
add(stopbutton2);
stopbutton1.addActionListener(this);
startbutton.addActionListener(this);
stopbutton2.addActionListener(this);
stopbutton1.setBounds(new Rectangle(35, 147, 60, 30));
startbutton.setBounds(new Rectangle(115, 147, 60, 30));
stopbutton2.setBounds(new Rectangle(195, 147, 60, 30));
repaint();
//dann noch ein bißl Quelltext…
public void update(Graphics g){
paint(g);
}
public void paint(Graphics g)
{
g.drawImage(image0, 10, 15, this);
try{
g.clipRect(15,13,300,85);
g.drawImage(image1,14,15,this);
g.drawImage(image2,104,15,this);
g.drawImage(image3,194,15,this);
}
catch(Exception e){e.printStackTrace();}
}
}
Und??? Hilft’s??? Das repaint() hab ich ja schon drin…