943,708 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 613
  • Java RSS
Nov 19th, 2008
0

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

Expand Post »
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 .....
Similar Threads
Reputation Points: 1
Solved Threads: 3
Junior Poster
localp is offline Offline
190 posts
since Apr 2008
Nov 19th, 2008
0

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

Java Syntax (Toggle Plain Text)
  1. new GridDrawingApplet();

you don't need to explicitly call paint
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Nov 19th, 2008
0

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

Java Syntax (Toggle Plain Text)
  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 ??
Reputation Points: 1
Solved Threads: 3
Junior Poster
localp is offline Offline
190 posts
since Apr 2008
Nov 19th, 2008
0

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

sorry i assumed you knew where to place it

Java Syntax (Toggle Plain Text)
  1. public static void main(String []args)
  2. {
  3. new GridDrawingApplet();
  4. }
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Nov 19th, 2008
0

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

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......
Reputation Points: 5
Solved Threads: 0
Newbie Poster
anil_forum is offline Offline
5 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Play a wav. file
Next Thread in Java Forum Timeline: Java Excel connectivity code





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC