calling a function very basic >>> <<<<

Reply

Join Date: Apr 2008
Posts: 102
Reputation: localp is an unknown quantity at this point 
Solved Threads: 2
localp localp is offline Offline
Junior Poster

calling a function very basic >>> <<<<

 
0
  #1
Nov 19th, 2008
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 .....
Local P ...
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,158
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 136
dickersonka dickersonka is offline Offline
Veteran Poster

Re: calling a function very basic >>> <<<<

 
0
  #2
Nov 19th, 2008
  1. new GridDrawingApplet();

you don't need to explicitly call paint
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 102
Reputation: localp is an unknown quantity at this point 
Solved Threads: 2
localp localp is offline Offline
Junior Poster

Re: calling a function very basic >>> <<<<

 
0
  #3
Nov 19th, 2008
Originally Posted by dickersonka View Post
  1. 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 ??
Local P ...
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,158
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 136
dickersonka dickersonka is offline Offline
Veteran Poster

Re: calling a function very basic >>> <<<<

 
0
  #4
Nov 19th, 2008
sorry i assumed you knew where to place it

  1. public static void main(String []args)
  2. {
  3. new GridDrawingApplet();
  4. }
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 5
Reputation: anil_forum has a little shameless behaviour in the past 
Solved Threads: 0
anil_forum anil_forum is offline Offline
Newbie Poster

Re: calling a function very basic >>> <<<<

 
0
  #5
Nov 19th, 2008
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......
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC