aspose file tools
The moose likes Swing / AWT / SWT / JFace and the fly likes Urgent Pls Help - Painting Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "Urgent Pls Help - Painting" Watch "Urgent Pls Help - Painting" New topic
Author

Urgent Pls Help - Painting

Garry Kalra
Ranch Hand

Joined: May 25, 2001
Posts: 111
I'm currently building a GUI and in the main window, i add panels in the center(BorderLayout). I have two panels and depending on a button, i display one of them.
When the switch has to happen, i remove the first and display the other. But during this i am facing refresh problems.
Can anybody guide what to do as i am confused about validate, invalidate, setVisible. What to use.
Any help will be greatly appreciated.
Garry
tmtully
Greenhorn

Joined: Jun 01, 2001
Posts: 4
I've ran into this before, but what fixed it for me was the following:
1) remove the component from the container
2) call invalidate on the container
3) call validate on the container
4) then repaint.
Originally posted by Garry Kalra:
I'm currently building a GUI and in the main window, i add panels in the center(BorderLayout). I have two panels and depending on a button, i display one of them.
When the switch has to happen, i remove the first and display the other. But during this i am facing refresh problems.
Can anybody guide what to do as i am confused about validate, invalidate, setVisible. What to use.
Any help will be greatly appreciated.
Garry

Tim Tully
Greenhorn

Joined: Sep 16, 2001
Posts: 8
I've ran into this before, but what fixed it for me was the following:
1) remove the component from the container
2) call invalidate on the container
3) call validate on the container
4) then repaint.
Originally posted by tmtully:
I've ran into this before, but what fixed it for me was the following:
1) remove the component from the container
2) call invalidate on the container
3) call validate on the container
4) then repaint.

Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4120

You could also use CardLayout on a parent panel that contains the two panels you want to switch between, and just use the button to switch between 'cards'...

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
 
subject: Urgent Pls Help - Painting
 
Threads others viewed
Variable Scope Problem
Urgent Pls help - Repainting GUI
Help with Layout
Why doesn't a component in a Listbox see mouse clicks when using a DefaultListCellRenderer ?
Regarding status bar resizing
MyEclipse, The Clear Choice