Link to home
Start Free TrialLog in
Avatar of Xadina
Xadina

asked on

Refresh view of the entire GUI

HI!
I am building an interactive circuit application.  The menu bar displays a menu and allows the user to access a number of functions.  One of them is:
Refresh view of entire GUI.
I have searched for some code but I didn't find anything.
Can u help pls?
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pmunly
pmunly

This will update every GUI object.  Say you have a JFrame named Frame and it is your 'main' window:

Frame.update( Frame.getGraphics() );

That should repaint everything contained within 'Frame' as well as 'Frame' itself.
Oh... forgot to add that the 'update()' method is part of the java.awt.Container class and that the 'getGraphics()' method is part of the java.awt.Component class.
> Frame.update( Frame.getGraphics() );


you should not call update (or paint) directly.

Avatar of Xadina

ASKER

I need to referesh the view of the GUI, cos since the GUI lets the user draw a circuit, at any point he might want to start all over again. so he presses refresh.
Well, i have to do it, even if it doesn't make sense or it will loose me marks in the exam! :-)

Thanks.
> at any point he might want to start all over again.

Sorry misunderstood what you meant by refresh.
It sounds like what you want to do is clear what the user has previously drawn. What you need to do for this depends on how you have implemented your drawing.