I have a panel with some components. Initially I had set the layout to BoxLayout and when I removed components from the panel and call for myPanel.validate(), the panel get flushed away. myPanel is inside the scrollPane. Now I changed from BoxLayout to FlowLayout and changed teh size of the panel as below:
I am following the same procedure, after removing components, I am calling myPanel.validate(); But now, not everything gets flushed, but I could see some piece of info in the display. But they get cleared when I minimise the window and maximise it? How do I overcome this problem?
Originally posted by Gopu Akraju: I tried myPanel.repaint(); tehn calling myPanel.validate(); and now it works. Is this the correct way?
I have seen many here use JPanel#revalidate() sometimes followed by JPanel#repaint(), but to be honest, I don't know what the canonical way to do this is.
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
a bit of art, as a gift, that will fit in a stocking