Java Code Examples for java.awt.desktop.QuitHandler

The following are top voted examples for showing how to use java.awt.desktop.QuitHandler. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: _AppEventHandler.java   View source code 5 votes vote down vote up
void performUsing(final QuitHandler handler, final _NativeEvent event) {
    if (_AppMiscHandlers.isSuddenTerminationEnbaled()) {
        performDefaultAction(event);
        return;
    }
    final MacQuitResponse response = obtainQuitResponse(); // obtains the "current" quit response
    handler.handleQuitRequestWith(new QuitEvent(), response);
}
 
Example 2
Project: openjdk9   File: _AppEventHandler.java   View source code 4 votes vote down vote up
void performUsing(final QuitHandler handler, final _NativeEvent event) {
    final MacQuitResponse response = obtainQuitResponse(); // obtains the "current" quit response
    handler.handleQuitRequestWith(new QuitEvent(), response);
}
 
Example 3
Project: openjdk-jdk10   File: Desktop.java   View source code 3 votes vote down vote up
/**
 * Installs the handler which determines if the application should quit. The
 * handler is passed a one-shot {@link java.awt.desktop.QuitResponse} which can cancel or
 * proceed with the quit. Setting the handler to {@code null} causes
 * all quit requests to directly perform the default {@link QuitStrategy}.
 *
 * @param quitHandler the handler that is called when the application is
 * asked to quit
 *
 * @throws SecurityException if a security manager exists and it
 * will not allow the caller to invoke {@code System.exit} or it denies the
 * {@code RuntimePermission("canProcessApplicationEvents")} permission
 * @throws UnsupportedOperationException if the current platform
 * does not support the {@link Desktop.Action#APP_QUIT_HANDLER} action
 * @since 9
 */
public void setQuitHandler(final QuitHandler quitHandler) {
    checkEventsProcessingPermission();
    checkQuitPermission();
    checkActionSupport(Action.APP_QUIT_HANDLER);
    peer.setQuitHandler(quitHandler);
}
 
Example 4
Project: openjdk-jdk10   File: DesktopPeer.java   View source code 2 votes vote down vote up
/**
 * Installs the handler which determines if the application should quit.
 *
 * @param quitHandler the handler that is called when the application is
 * asked to quit
 * @see java.awt.Desktop#setQuitHandler(java.awt.desktop.QuitHandler)
 */
default void setQuitHandler(final QuitHandler quitHandler) {
}
 
Example 5
Project: openjdk-jdk10   File: Application.java   View source code 2 votes vote down vote up
/**
 * Installs the handler which determines if the application should quit.
 * The handler is passed a one-shot {@link QuitResponse} which can cancel or proceed with the quit.
 * Setting the handler to {@code null} causes all quit requests to directly perform the default {@link QuitStrategy}.
 *
 * @param quitHandler the handler that is called when the application is asked to quit
 * @since Java for Mac OS X 10.6 Update 3
 * @since Java for Mac OS X 10.5 Update 8
 */
public void setQuitHandler(final QuitHandler quitHandler) {
    eventHandler.quitDispatcher.setHandler(quitHandler);
}
 
Example 6
Project: openjdk9   File: Desktop.java   View source code 2 votes vote down vote up
/**
 * Installs the handler which determines if the application should quit. The
 * handler is passed a one-shot {@link java.awt.desktop.QuitResponse} which can cancel or
 * proceed with the quit. Setting the handler to {@code null} causes
 * all quit requests to directly perform the default {@link QuitStrategy}.
 *
 * @param quitHandler the handler that is called when the application is
 * asked to quit
 *
 * @throws SecurityException if a security manager exists and it
 * will not allow the caller to invoke {@code System.exit}
 * @throws UnsupportedOperationException if the current platform
 * does not support the {@link Desktop.Action#APP_QUIT_HANDLER} action
 * @since 9
 */
public void setQuitHandler(final QuitHandler quitHandler) {
    checkQuitPermission();
    checkActionSupport(Action.APP_QUIT_HANDLER);
    peer.setQuitHandler(quitHandler);
}
 
Example 7
Project: openjdk9   File: DesktopPeer.java   View source code 2 votes vote down vote up
/**
 * Installs the handler which determines if the application should quit.
 *
 * @param quitHandler the handler that is called when the application is
 * asked to quit
 * @see java.awt.Desktop#setQuitHandler(java.awt.desktop.QuitHandler)
 */
default void setQuitHandler(final QuitHandler quitHandler) {
}