File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes i'm getting an error start:applet not intialized. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply Bookmark "i Watch "i New topic
Author

i'm getting an error start:applet not intialized.

malhar deshpande
Greenhorn

Joined: Nov 12, 2011
Posts: 5
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

/*<applet code="demo13" width=300 height=200>
</applet>
*/

class Lines extends Applet implements MouseListener{

int mousex=0,mousey=0,movx=0,movy=0;

public void init(){

addMouseListener(this);

}


public void mouseExited(MouseEvent me){
}

public void mouseEntered(MouseEvent me){
}

public void mouseClicked(MouseEvent me){
}

public void mousePressed(MouseEvent me){

mousex=me.getX();
mousey=me.getY();
repaint();
}

public void mouseReleased(MouseEvent me){

movx=me.getX();
movy=me.getY();
repaint();
}

public void paint(Graphics g){

g.drawLine(mousex,mousey,movx,movy);

}
}
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 1652
Its hard to tell what you are doing since we don't see the HTML you are using to invoke the applet.

However based on the comment in your code you may not be specifying the applet class correctly.

Your class is called "Line" so the applet code value should be "Line.class", not "demo13".
malhar deshpande
Greenhorn

Joined: Nov 12, 2011
Posts: 5
hi...
wih the help of above code i'm trying to draw lines just like in "paint".that's why i am using 4 integer variables to get the coordinates of the inital and final position of the cursor.
thanks for your reply but your suggestion didn't work.its still giving the same error.
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18368

I'll move this thread to our Applets forum.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
malhar deshpande
Greenhorn

Joined: Nov 12, 2011
Posts: 5
ok i resolved the problem

i made corrections as told to me in above posts and in addition i didn't declare the class public.Now the program is working but i am not able to hold the lines,they vanish as soon as they are created....reply me as soon as possible.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 1652
i am not able to hold the lines,they vanish as soon as they are created


See: Custom Painting Approaches.
 
 
subject: i'm getting an error start:applet not intialized.
 
Threads others viewed
MouseMotionListener
Hand Cursor
TextField Population of Mouse Events?
Not able to compile
unusual behaviour of subclass of JPanel
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture