NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
I am writing customized mouse handling by extending the MouseHelper class. Depending on a display button selectable by the user, I need the application to toggle between different MouseHelper classes (the old one and my new one(s) ). I've created an extended MouseHelper class called MouseGateHelper, and when the user clicks the appropriate display button, the program creates a new DefaultDisplayRendererJ2D that uses this MouseHelper subclass. But I can't find a method for telling display to use this new display renderer (DisplayImpl only has a getRenderer(), not a setRenderer() methods). When a user selects the alternative mousehandling, the application constructs MouseGateHelper, but then continues to handle mouse events using the old MouseHelper. I may be overlooking something obvious--here's the code: //MouseGateHelper extends MouseHelper for customized mouse events DisplayImpl display = ... DefaultDisplayRendererJ2D dr = new DefaultDisplayRendererJ2D(MouseGateHelper.class); try{ dr.setDisplay(display); } catch (VisADException e) {} MouseBehaviorJ2D mb = new MouseBehaviorJ2D(dr,surrogate2.MouseGateHelper.class); display.setMouseBehavior(mb);
visad
archives: