import java.awt.*; import java.awt.event.*; import java.applet.*; import java.util.*; import java.awt.image.*; public class Mousedrag implements MouseMotionListener { public void init() { ***addMouseMotionListener(this); ***setBackground(Color.black); } public void mouseDragged(MouseEvent me) { BufferedImage image = new BufferedImage(200,200, BufferedImage.TYPE_INT_RGB); Graphics g=image.getGraphics(); g.setColor(Color.black); g.fillOval(20,20,20,20); } public void mouseMoved(MouseEvent me) { } } /*errors at lines with **** at the begin*
what is the error?
You have to pick a component to add the mouse listener to.
i'm a newbie.... can u please modify the code...so that i can run it succesfully
The class Mousedrag is not currently a component. Have it extend some component and it should work I think.
Maybe 'extends Applet' will fix it.
okie.... extends Applet implements MouseMotionListener workss!!!!!!!11 thanks a lot!!!!!!!!!!!!
<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>JSP PLUGIN </title> </head> <body bgcolor="pink"> <h1>Applet plugin in jsp</h1> <jsp:plugin align="middle" height="500" width="500" type="applet" code="Mousedrag.class" name="clock" codebase="."> <jsp:fallback> Plugin tag OBJECT or EMBED not supported by browser. </jsp:fallback> </jsp:plugin> </body> </html>
tomcat--->webapps-->ROOT---->applet---->Mousedrag.class mouse.jsp.html
what's wrong noww...? :'( Help me if u r free @wio
try using another browser
using internet explorer also..resulting the same
what is the html?
mouse.html which i have pasted in the reply above,..
Well sense the fallback is triggering, it means for some reason the applet isn't loading correctly.
Maybe it isn't finding the .class file correctly
what should i do now...? :(
try to find Mousedrag.class on localhost
make sure that it is able to download the class file
yes it is getting downloaded!!!!
should i use EMBED or OBJECT tag in the html file?
Try them both.
lol....how?? :D
I mean try embed, then try object if embed doesn't work
or put all 3 at the same time lol
codebase itself is not supported in html5 it seems.... all modern browsers use.. latest html versions... what shud i doo....lol feel like killing myself!!
Do you have to use java?
ofcourse...lol I will be awarded with a biggggggg zeroooooo if i don't use it!!!
is this the reasony i dont get it????
But that browser is GOOGLE CHROME... :D
Yeah, get java plugin.
Join our real-time social learning platform and learn together with your friends!