Re: Spread Sheet Mouse Listeners

Hi Rick,

> I also want to add a listener to the SSCell so that if a right click
> happens over the cell, the popup menu is displayed.  Currently
> though popup menu's won't display over the cell and mouse events
> don't work.
> My guess is that the SSCell has its own mouse handling stuff and
> is capturing my clicks before my functions can handle it.  As to
> why the menu doesn't display over the cell even when the click isn't
> on the cell i don't know...

I just added new DisplayEvents for MOUSE_PRESSED_RIGHT
and MOUSE_PRESSED_LEFT.  Call the addDisplayListener()
method on your FancySSCell to create a link to a
DisplayListener, then in your DisplayListener:

  public void displayChanged( DisplayEvent e ) {
    if (e.getId() == DisplayEvent.MOUSE_PRESSED_RIGHT) {
      // activate popup menu

These new DisplayEvents are now on our ftp server.

The reason your popup menu won't show over the FancySSCell
is that the popup is lightweight (i.e., not associated with
a native window) but the FancySSCell display is heavyweight
because that is what Java3D needs to run OpenGL.  This is a
long-standing Java problem that won't be fixed any time soon.
The work-around is to use heavyweight Components (e.g., AWT
rather than Swing) for things that must appear over Java3D.

Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738

  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: