hey guys I am Kareem a new member here.
actually I was trying to publish a simple applet to a web page when I met a problem that the plugin cannot find my class although I put the .jar file in the same path of the html one and this is ma java code:
package mainpackage; import java.awt.Graphics; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.ImageIcon; import javax.swing.JApplet; public class ImageMapping extends JApplet { private ImageIcon mapImage; private static final String captions[] = {"you're on icon number 1","you're on icon number 2","you're on icon number 3", "you're on icon number 4","you're on icon number 5", "you're on icon number 6","you're on icon number 7" }; public void init () { addMouseListener( new MouseAdapter() { public void mouseExited (MouseEvent event) { showStatus("you're outside the image!"); } } ); addMouseMotionListener( new MouseMotionAdapter() { public void mouseMoved (MouseEvent event) { showStatus(translateLocation(event.getX(),event.getY())); } } ); mapImage = new ImageIcon (getClass().getResource("../resource/icons.png")); } public void paint (Graphics g) { super.paint(g); mapImage.paintIcon(this, g, 0, 0) } public String translateLocation (int x, int y) { if(x >= mapImage.getIconWidth() || y >= mapImage.getIconHeight()){ return ""; } double iconWidth = mapImage.getIconWidth()/7.0; int iconNumber = (int) ((double) x/iconWidth); return captions[iconNumber]; } }
and this is my html code:
<html> <head> <title> Applet Example </title> </head> <body> <applet code = "mainpackage.ImageMapping.class" width = "606" height "90" archive = "imageMaping.jar"> there's an error </applet> </body> </html>
actually I don't know what's wrong with my codes, when I open the web page I just find error: click for details, when I check the details a java window just appears and tells :
Java Plug-in 10.6.2.24
Using JRE version 1.7.0_06-b24 Java HotSpot(TM) Client VM
User home directory = C:\Users\DELL
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------