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

new GridDrawingApplet();

you don't need to explicitly call paint

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

sorry i assumed you knew where to place it

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.