How can I close a JFrame by click on a button?
Posted
by Roman
on Stack Overflow
See other posts from Stack Overflow
or by Roman
Published on 2010-04-08T13:05:24Z
Indexed on
2010/04/08
13:13 UTC
Read the original article
Hit count: 159
I would like to have a button in my window such that if I click it (button) the window is closed.
I found out that I can close a window in the following way:
referenceToTheFrame.hide(); //hides the frame from view
refToTheFrame.dispose(); //disposes the frame from memory
But if I do this way, compiler complains:
Note: myProgram.java uses or overrides a deprecated API
Note: Recompile with -Xlint:deprication for details.
Do I do something unsafe?
© Stack Overflow or respective owner