Re: Spread Sheet Mouse Listeners

Hi Bill and Rick,

To get Swing to produce heavyweight popup menus to display over a
canvas3d try:

    // Make sure we use heavyweight popup menus

early in the program and any popup menus created after that will be
heavyweight. JDK1.2 has a bug with cascaded heavyweight popups but that
appears to be fixed in JDK1.2.2.


Bill Hibbard wrote:
> 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

Tim Stevenson
Surpac Software International
162A Roslyn Avenue, Blackmans Bay, Tasmania, Australia 7052
Phone/Fax:      +61 3 62294610
Home Phone:     +61 3 62298866
Email:          tims@xxxxxxxxxx