View Single Post
  #1 (permalink)  
Old 07-31-2007, 07:16 PM
paty paty is offline
Member
 
Join Date: Jul 2007
Posts: 41
paty is on a distinguished road
how to place an image in an applet
Hello people can anyone tell me how I place an image in an applet once someone has clicked the mouse.

I have already got an image drawn on the applet, imgBackground, and I want to place the image, imgZero, over the top of the image already there when someone clicks the mouse. Here is my code :
Code:
import java.applet.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class gameClass extends Applet implements ActionListener { private Image imgBackground, imgZero; public void init() { imgBackground = getImage(getDocumentBase(), "Back.gif"); imgZero = getImage(getDocumentBase(), "zero.gif"); } public void paint(Graphics g) { g.drawImage(imgBackground,0,0,this); } public void mouseClicked(MouseEvent event) { } public void actionPerformed(ActionEvent event) { } }
Reply With Quote
Sponsored Links