Results 1 to 2 of 2

Thread: Easy Q

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517

    Arrow Easy Q

    I asked a question of why this other code didnt work.
    I was givin this code here

    Code:
    public void paint(Graphics g) 
    { 
    g.drawString("string",xloc,yloc); 
    }
    This writes directly on the applet?

    So I tried to use it like this

    Code:
    /**Start the applet*/
      public void start() {
           paint(appletl);
      }
    
    public void paint(Graphics g)
    {
    g.drawString("Hi there",11,11);
    }
    It wont work. How do I call paint, and what is 'Graphics g'?

  2. #2
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    You don't have to call it. Look at this applet:

    Code:
    package test;
    import java.awt.*;
    public class test extends JApplet
    {
      int x = 5;
      int y = 25;
      public void paint(Graphics g)
      {
        g.drawString("Hello World", x, y);
      }
    }
    This will automatically paint "Hello World" to the applet.
    Alcohol & calculus don't mix.
    Never drink & derive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width