Results 1 to 5 of 5

Thread: REFRESHING THE SCREEN {I'm a beginner}

  1. #1
    NOMADMAN
    Guest

    REFRESHING THE SCREEN {I'm a beginner}

    Sorry for the lame question but I got a whole bunch of my GUI in my JApplet, under the paint class

    public void paint( Graphics g ) {
    ...
    }

    I also have a button addButton, when I click the button it edits the information that is being displayed, how do I refresh the screen so the new info is shown?!?!

    I.E. Like clearing the current applet display and then calling the paint class again, how you do that?!?! It's probably real simple...

    THANKS!

    NOMAD

    P.S. This is an ASAP subject, I need it within a couple hours, PLEASE!!!

  2. #2
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

    Lightbulb

    i've been having trouble with that too but look at the Container class methods update (Graphics) and repaint() that might help. I've been playing with them but haven't gotten very far. If you figure them out plz do tell.

    Does anyone know how to do this for a console? like [B]cls[\B] in BASIC?
    Last edited by CaptainPinko; Dec 15th, 2001 at 08:35 AM.
    "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

  3. #3
    NOMADMAN
    Guest

    I got mine to work with repaint();

    I used repaint(); but I think it only worked cause I'm using an Applet. I don't know about the first, didn't try it. As for your CLS question I have NO idea. Thats what I'd like to know. Oh I did hve to do this to make the screen faign a refresh...

    SetVisible( false );
    SetVisible( true );
    repaint;

    This worked fine for me. And since my project isn't memory intensive, I don't think it'll matter too much. Other than bad style!

    NOMAD

    p.s. THANKS!!!

  4. #4
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332
    repaint() is inherited from Container and therefore that should work for any subclass of container, and i think all top-level containers are. are you sure you need that setVisible(tru\flase) thing? did you try w/o?
    "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

  5. #5
    NOMADMAN
    Guest
    Yes and it seemed that the numbers where pasting over the tops of the old, so I added both the true and false statments at the same time

    and hey why tamper with it if it works and I've already turned it in


    NOMAD

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