Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

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.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690