remnants of deleted component still displayed on screen.

J

Justin

I cant for the life of me figure this out.

I have a JPanel inside a JScrollbar inside another JPanel inside a
JPanel inside another JScrollBar inside an extended JDialogBox.

I have code to remove an element from the innermost JPanel. I then
called validate(); on the inner most JPanel and JScrollBar. However,
the graphic of the component remains. So then I proceded to call
validate on all components in the heirarchy, and still the graphic
remains.

It's probably something absoletly retarded that I'm forgetting to do,
but it is irritating the hell out of me.
 
J

Justin

Part of the code is adding and removing componenets. The user selects
a componenet that he/she does not want anymore, and it is removed from
the list (the list exists inside the innermost JPanel). As long as
there is 1 or more instantiated elements, it works fine. I am guessing
because it paints itself over the remnants of the deleted element.
However, when I delete the last element, I would like just a grey
background to show. I did try setting the background to grey after
removing all components, but to no avail.
 
R

Robert

Justin said:
Part of the code is adding and removing componenets. The user selects
a componenet that he/she does not want anymore, and it is removed from
the list (the list exists inside the innermost JPanel). As long as
there is 1 or more instantiated elements, it works fine. I am guessing
because it paints itself over the remnants of the deleted element.
However, when I delete the last element, I would like just a grey
background to show. I did try setting the background to grey after
removing all components, but to no avail.

I would attempt to add the innermost JPanel to the innermost JScrollPane again
using setViewportView or similar. This has obviously not been tested etc but I
seem to recall that it works.

All the best,

Robert
 
J

Justin

Thank you thank you thank you

Did the trick...

I would attempt to add the innermost JPanel to the innermost JScrollPane again
using setViewportView or similar. This has obviously not been tested etc but I
seem to recall that it works.

All the best,

Robert
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top