PDA

Click to See Complete Forum and Search --> : REFRESHING THE SCREEN {I'm a beginner}


NOMADMAN
Dec 15th, 2001, 01:38 AM
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!!! :eek:

CaptainPinko
Dec 15th, 2001, 07:31 AM
i've been having trouble with that too :p 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?

NOMADMAN
Dec 15th, 2001, 10:12 AM
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!!!

CaptainPinko
Dec 15th, 2001, 10:32 AM
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?

NOMADMAN
Dec 15th, 2001, 11:36 PM
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