0

I want to know how to call the above function ???

import java.awt.*;
import java.applet.Applet;
import java.awt.event.*; 

public class GridDrawingApplet extends Applet {

  public void paint (Graphics g) 
  {
    // Draw the vertical lines:
    g.drawLine (0,0, 0,240);

  }
}

public static void main(String []args)
{

    // now i want to call the above function here how do i do it ....
  //   the void paint (Graphics g)  function
}

can some one plzz help me with the code .....

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by anil_forum
0
new GridDrawingApplet();

you don't need to explicitly call paint

so how can i display the content of paint.. wat i am expecting here is to display the content of paint, from the main program.. how can i do that ??

0

sorry i assumed you knew where to place it

public static void main(String []args)
{
   new GridDrawingApplet();
}
0

an applet do not require main method
to run your code include the following method
public void init()
{
}
and one comment
//<applet code=GridDrawingApplet height=300 width=300></applet>

and run this code after compiling by writing
appletviewer GridDrawingApplet

and remove main method......

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.