Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

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*

OpenStudy (anonymous):

what is the error?

OpenStudy (anonymous):

OpenStudy (anonymous):

You have to pick a component to add the mouse listener to.

OpenStudy (anonymous):

i'm a newbie.... can u please modify the code...so that i can run it succesfully

OpenStudy (anonymous):

The class Mousedrag is not currently a component. Have it extend some component and it should work I think.

OpenStudy (anonymous):

Maybe 'extends Applet' will fix it.

OpenStudy (anonymous):

okie.... extends Applet implements MouseMotionListener workss!!!!!!!11 thanks a lot!!!!!!!!!!!!

OpenStudy (anonymous):

<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>

OpenStudy (anonymous):

OpenStudy (anonymous):

tomcat--->webapps-->ROOT---->applet---->Mousedrag.class mouse.jsp.html

OpenStudy (anonymous):

what's wrong noww...? :'( Help me if u r free @wio

OpenStudy (anonymous):

try using another browser

OpenStudy (anonymous):

using internet explorer also..resulting the same

OpenStudy (anonymous):

what is the html?

OpenStudy (anonymous):

mouse.html which i have pasted in the reply above,..

OpenStudy (anonymous):

Well sense the fallback is triggering, it means for some reason the applet isn't loading correctly.

OpenStudy (anonymous):

Maybe it isn't finding the .class file correctly

OpenStudy (anonymous):

what should i do now...? :(

OpenStudy (anonymous):

try to find Mousedrag.class on localhost

OpenStudy (anonymous):

make sure that it is able to download the class file

OpenStudy (anonymous):

yes it is getting downloaded!!!!

OpenStudy (anonymous):

OpenStudy (anonymous):

should i use EMBED or OBJECT tag in the html file?

OpenStudy (anonymous):

Try them both.

OpenStudy (anonymous):

lol....how?? :D

OpenStudy (anonymous):

I mean try embed, then try object if embed doesn't work

OpenStudy (anonymous):

or put all 3 at the same time lol

OpenStudy (anonymous):

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!!

OpenStudy (anonymous):

Do you have to use java?

OpenStudy (anonymous):

ofcourse...lol I will be awarded with a biggggggg zeroooooo if i don't use it!!!

OpenStudy (anonymous):

is this the reasony i dont get it????

OpenStudy (anonymous):

But that browser is GOOGLE CHROME... :D

OpenStudy (anonymous):

Yeah, get java plugin.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!