Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
malhar deshpande
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2616
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll move this thread to our Applets forum.
 
malhar deshpande
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2616
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am not able to hold the lines,they vanish as soon as they are created


See: Custom Painting Approaches.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic