Update on the FullScreen ESC API proposal.
David.Hill at Oracle.com
Tue Jun 11 08:42:54 PDT 2013
Richard has proposed an API for the FullScreen/ESC/Overlay issue in
The proposal is pasted below, please consider watching/updating in the jira with comments.
* Specifies what KeyCombination will allow the user to exit full screen mode.
* A value of KeyCombination.NO_MATCH will not match any KeyEvent and will make it so
* the user is not able to escape from Full Screen mode. A value of null means that
* the default platform specific key combination should be used.
public final void setFullScreenExitKeyCombination(KeyCombination keyCombination);
public final KeyCombination getFullScreenExitKeyCombination();
public final ObjectProperty<KeyCombination> fullScreenExitKeyProperty();
* Specifies the text to show when a user enters full screen mode, usually used
* to indicate the way a user should go about exiting out of full screen mode. A
* value of null will result in the default per-locale message being displayed. If set
* to the empty string, then no message will be displayed.
public final void setFullScreenExitHint(String value);
public final String getFullScreenExitHint();
public final BooleanProperty fullScreenExitHintProperty();
We would also add (as the JavaDocs above indicate) a NO_MATCH public
static final KeyCombination to KeyCombination, which would be a
KeyCombination who's "match" always returns false, thereby never
matching anything. This API allows you to solve the following use cases
in, what I think, is a pretty minimally invasive manner:
* I want to customize what key is used to exit *
stage.setFullScreenExitKeyCombination(new KeyCharacterCombination("w", KeyCombination.CONTROL_DOWN));
Note that this should also play into the default exit hint text, such that it should now say "CTRL+W" instead of "ESC"
* I want to customize the displayed hint *
stage.setFullScreenExitHint("Don't even think about leaving this game!");
* I want to show my own exit hint *
// then in your own code construct your own message
* I want to hide the exit hint but still allow the user to exit *
* I want to disallow the user from exiting full screen *
* I want to restore the default exit hint *
stage.setFullScreenExitHint(null); // restore to default
Changing either property would result in a SecurityException when necessary by an installed SecurityManager.
Note that we could also have a command line property:
-Djavafx.fullScreenExitEnabled=false which would ignore these settings
and turn off exiting in all cases. I'm not sure that it is important to
have a system property for this with proper API also being available, so
I would opt to just go with the API for now and add the system property
later if we want? Alternatively we could go with
-Djavafx.stage.fullScreenDefault=disabled or some other way to specify
that the default behavior is disabled, but if a specific stage has
provided a different default key combination / hint then we'll use that
instead. Or we could add API to Application later which would be
applicable to all Stages. But for now I would start with just the API on
Stage and see how far that takes us.
David Hill <David.Hill at Oracle.com>
Java Embedded Development
One of the keys to happiness is a bad memory.
-- Rita Mae Brown
More information about the openjfx-dev