UserSessionListener (Java SE 14 & JDK 14)
Description: declaration: module: java.desktop, package: java.awt.desktop, interface: UserSessionListener
Keywords: java.awt.desktop.UserSessionListener interface

Module java.desktop
Package java.awt.desktop

# Interface UserSessionListener

All Superinterfaces:
  `EventListener`, `SystemEventListener`

    public interface UserSessionListener
    extends SystemEventListener

Implementors receive notification when the user session changes.

This notification is useful for discontinuing a costly animation, or indicating that the user is no longer present on a network service.

Some systems may provide a reason of the user session change.

Since:
  9
See Also:
  `UserSessionEvent.Reason.UNSPECIFIED`, `UserSessionEvent.Reason.CONSOLE`, `UserSessionEvent.Reason.REMOTE`, `UserSessionEvent.Reason.LOCK`

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `userSessionActivated​(UserSessionEvent e)` | Called when the user session has been switched to.
  `void` | `userSessionDeactivated​(UserSessionEvent e)` | Called when the user session has been switched away.

- ## Method Details

  - ### userSessionDeactivated

    void userSessionDeactivated​(UserSessionEvent e)
    Called when the user session has been switched away.
    Parameters:
      `e` - the user session switch event

  - ### userSessionActivated

    void userSessionActivated​(UserSessionEvent e)
    Called when the user session has been switched to.
    Parameters:
      `e` - the user session switch event