Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JBuilder 2005 & graphics in applets

843807Aug 9 2005
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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2005
Added on Aug 9 2005
0 comments
101 views