aspose 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
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: 2225
    
    8
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
Sheriff

Joined: Oct 27, 2005
Posts: 19781
    
  20

I'll move this thread to our Applets forum.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
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: 2225
    
    8
i am not able to hold the lines,they vanish as soon as they are created


See: Custom Painting Approaches.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i'm getting an error start:applet not intialized.