Add save option to setDefaultCloseOperation #19

Closed
opened 2017-12-18 09:24:06 +00:00 by antograb · 2 comments
Owner

Currently :
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Currently : setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
antograb added the enhancement label 2017-12-18 09:24:06 +00:00
Collaborator

From the documentation :

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 registered WindowListener 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.

We will probably have to use WindowListener.

From [the documentation](https://docs.oracle.com/javase/8/docs/api/javax/swing/JFrame.html#setDefaultCloseOperation-int-) : > 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 registered WindowListener 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. We will probably have to use `WindowListener`.
regar42 self-assigned this 2017-12-26 20:58:43 +00:00
Collaborator

Implemented in #23

Implemented in #23
Sign in to join this conversation.
2 Participants
Notifications
Due Date
-
Dependencies

No dependencies set.

Reference: antograb/TpMazeJava#19