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.

Re: Overriding default mouse behavior

Hi Charles,

I just tried this with the two attached classes, patterned
after yours. The command:

  java visad.test.MouseSuperceded

printed "done" and exitted without throwing the Error.
There may be something wrong with your Java or VisAD
installation.

Also, please don't send email from 'root@localhost.localdomain'
as it is not a legal address for replies.

Good luck,
Bill

root wrote:
> 
> To override the default mouse behavior in a 2D VisAD window,
> I was advised here to take a look at
>         http://www.unidata.ucar.edu/glimpse/visad-lis/2255
> I believe I have reproduced the logic of that example below,
> and so I wonder why I got the following run-time error:
> 
> "Exception in thread "main" visad.VisADError: cannot construct
> class MouseSupercede at visad.java2d.DefaultDisplayRendererJ2D.
> createSceneGraph(DefaultDisplayRenderer"...[etc.]
> 
> ---------------------- EXAMPLE: -----------------
> import visad.*;
> import visad.java2d.*;
> import java.rmi.RemoteException;
> import java.awt.*;
> import javax.swing.*;
> 
> public class a11 {
> 
> public
> a11 (String[] args) throws RemoteException, VisADException {
> 
>     DisplayRendererJ2D DR
>          new DefaultDisplayRendererJ2D(MouseSuperceded.class);
>     DisplayImpl theDisp = new DisplayImplJ2D("theDisp", DR);
> }
> 
> public static void main(String[] args)
>     throws RemoteException, VisADException {
>         new a11(args);
>         }
> }
> 
> class DeadMouse extends MouseHelper {
> 
> public DeadMouse(DisplayRenderer DR, MouseBehavior MB) {
>         super(DR, MB);
> }
> }
> 
> class MouseSuperceded extends MouseBehaviorJ2D {
> 
> public MouseSuperceded(DisplayRendererJ2D dRd {
>         super(dRd, DeadMouse.class);
> }
> }
> ---------------- end of example -----------------------
> 
> As a sanity check, if I replace the line
>          new DefaultDisplayRendererJ2D(MouseSuperceded.class);
> with
>   new DefaultDisplayRendererJ2D
>         (visad.java2d.MouseBehaviorJ2D.class)
> I don't get the error.

-- 
----------------------------------------------------------
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
package visad.test;

import visad.*;

public class DeadMouse extends MouseHelper {
  public DeadMouse(DisplayRenderer DR, MouseBehavior MB) {
    super(DR, MB);
  }
}

package visad.test;

import visad.*;
import visad.java2d.*;
import java.rmi.*;

public class MouseSuperceded extends MouseBehaviorJ2D {
  public MouseSuperceded(DisplayRendererJ2D dRd) {
    super(dRd, DeadMouse.class);
  }

  public static void main(String[] args)
         throws RemoteException, VisADException {
    DisplayRendererJ2D DR
         new DefaultDisplayRendererJ2D(MouseSuperceded.class);
    DisplayImpl theDisp = new DisplayImplJ2D("theDisp", DR);
    System.out.println("done");
    System.exit(0);
  }
}

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