public void setDefaultCloseOperation(int operation)
- Sets the operation that will happen by default when the user initiates a "close" on this frame. You must specify one of the following choices:
DO_NOTHING_ON_CLOSE
(defined in WindowConstants
): Don't do anything; require the program to handle the operation in the windowClosing
method of a registered WindowListener
object.
HIDE_ON_CLOSE
(defined in WindowConstants
): Automatically hide the frame after invoking any registeredWindowListener
objects.
DISPOSE_ON_CLOSE
(defined in WindowConstants
): Automatically hide and dispose the frame after invoking any registered WindowListener
objects.
EXIT_ON_CLOSE
(defined in JFrame
): Exit the application using the System
exit
method. Use this only in applications.
The value is set to HIDE_ON_CLOSE
by default.
DO_NOTHING_ON_CLOSE => 아무 것도 안한다.
HIDE_ON_CLOSE => 프레임을 감춘다.
DISPOSE_ON_CLOSE => 프레임을 감추고 버린다. (그 프레임만 종료)
EXIT_ON_CLOSE => 프로그램 자체를 끈다 (모든 프레임을 종료)
이 상수를 쓸 시에는 JFrame. 을 앞에 붙여야 한다.
JFrame의 상수이기 때문이다.
댓글 없음:
댓글 쓰기