My application’s main frame starts a JFrame thread:
IBM1622GUI cardReadPunchGUI = new IBM1622GUI(); // instantiate
Thread cardReadPunchThread = new Thread(cardReadPunchGUI); // alloc thread
cardReadPunchThread.start(); // call thread's run() method
Later, the main frame needs to “destroy” IBM1622GUI (as part of “taking a peripheral offline”), and still later, to reinstantiate it – presumably using the same procedure as above. What should the main frame do to basically return to the state prior to when the IBM1622GUI was first instantiated?
EDIT – I should probably mention that IBM1622GUI, the JFrame class, is being developed with NetBeans as a “Swing GUI Form”, and thus there are certain limitations on what edits I can make to the source code.
Read this
You should use this style to init a JFrame.
When you want to close the JFrame, here is already the question with answers
(Edit by Chap: the linked SO thread is very long and meandering, but it boils down to simply using
cardReadPunchGUI.dispose(). This does, in fact, answer my question satisfactorily, and I’d like to give credit for this answer but I would also like for this note to be included.)