Save intermediate state: Taskpane, ModalDialog for Swing. MessageBox content not displayed correctly