In JBuilder 2005 I run the following code:
package gif;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class GIFApplet
extends JApplet implements ItemListener {
JComboBox cb;
Image img;
public void init() {
cb = new JComboBox();
Container c = getContentPane();
c.setLayout(new FlowLayout());
cb.addItem("1-ое изображение");
cb.addItem("2-ое изображение");
cb.addItem("3-ье изображение");
cb.addItemListener(this);
c.add(cb);
img = getImage(getCodeBase(), "1.gif");
}
public void paint(Graphics g) {
g.drawImage(img, 100, 100, this);
}
public void itemStateChanged(ItemEvent ie) {
}
}
As a result:
1) I can't see combobox on the form as it's painted over when the form repaints.
2) I jhave animated GIF-image. When the animation is showing, it does not redraw the whole picture, so it leaves rubbish on the screen frame by frame.
How can I correct this problems?