Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6462882

TrayIcon should support getLocationOnScreen()

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P5
    • Resolution: Unresolved
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      linux

      Description

      A DESCRIPTION OF THE REQUEST :
      java.awt.TrayIcon should have a public Point getLocationOnScreen() method.

      JUSTIFICATION :
      The TrayIcon API is very limited; at the moment you can only get it to show a text message, display a tooltip, and show a java.awt.PopupMenu. You can also have it respond to MouseEvents, for which, since you have the coordinates on the screen, you can have just about any sort of Java component show up. But this workaround isn't available for application-generated events; you can pop up a custom JDialog in the correct location for a mouse click, but not to indicate that the application state changed. Thus, the need for a getLocationOnScreen() method.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      java.awt.TrayIcon.getLocationOnScreen() should return an instance of Point representing the top-left corner of the component's bounds in the coordinate space of the screen, just as java.awt.Component.getLocationOnScreen() does.
      ACTUAL -
      This method does not currently exist.

      CUSTOMER SUBMITTED WORKAROUND :
      You could grab the location of the first MouseEvent and store it (and hope that the TrayIcon doesn't move), but that requires that the mouse would have interacted with the TrayIcon before you want to show any custom dialogs.

        Attachments

          Activity

            People

            Assignee:
            ant Anton Tarasov
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: