Results 1 to 6 of 6

Thread: manually calling paint

  1. #1

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919

    manually calling paint

    how do i pass it "Graphics g"?
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  2. #2

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    nvermind, got it

    Code:
    paint(getGraphics());
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    From what I know, paint() is a callback, and should only be called directly by the system (not that it really makes a difference), you should just call the repaint() method.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4

    Thread Starter
    Fanatic Member nabeels786's Avatar
    Join Date
    Jul 2001
    Location
    New York
    Posts
    919
    repaint didn't work for some reason.

    calling paint() did it, sort of. now i overrode the paint() function itself so no more flickering
    Visit www.fragblast.com
    Gaming, forums, and a online RPG/Battle system




    (__Flagg) DOT NET? is this a Hindi Dating service?

  5. #5
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332
    Originally posted by crptcblade
    From what I know, paint() is a callback, and should only be called directly by the system (not that it really makes a difference), you should just call the repaint() method.

    could you plz tell me more about the repaint() method? i 've never got it to work... PLZ!
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  6. #6
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Code:
       import javax.swing.*;
       import java.awt.*;
       import java.awt.event.*; 
      
      public class RedDewDrop{  
        public static void main(String[] args){
        new Circle();
      }
     }
      class Circle extends Canvas{
    
       public Circle(){
    
       JFrame jf = new JFrame("DewDrop");
        jf.addWindowListener(new WindowAdapter(){
           public void windowClosing(WindowEvent e){
              System.exit(0);
           }
        });
    
         Dimension size = jf.getSize();
         Insets i = jf.getInsets(); 
         int height = size.height - i.top - i.bottom;
         int width = size.width - i.left - i.right;
    
        this.setSize(height,width);
        jf.getContentPane().add(this);
        jf.setSize(400,300);
        jf.setVisible(true);
      }
     
       public void paint(Graphics g){
        g.setColor(Color.red);
         for(int i = 0; i < 100; i++){
          g.fillOval(50,50,i,i); 
            try{
             Thread.sleep(100);
           }catch(Exception e){System.err.println(e);}
        }
       }
      }

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