I have a JPanel in a JTabbedPane. I have an ActionListener attached to a JMenuItem that does basically this:
getNorthEastPanel().removeAll();
getNorthEastPanel().add(newPanelContents);
getNorthEastPanel().repaint();
That works just fine.
I also have a MouseListener elsewhere that updates this panel, using a reference to the GUI passed into the containing class. From the MouseListener, the contents are removed, but the JPanel doesn't repaint until either I minimize/maximize, or click on it. If I call revalidate(), it does repaint the JPanel - the desired behavior.
So, I have a workaround. But my question is, what's going on here? (I don't have a test case... if someone thinks it might help, I'll work one up.) Why would the same code work in one place and not in another place?
tia