Microsoft KB Archive/819602

= BUG: Compilation errors occur in JLCA converted Visual J++ projects that implement Mouse Event methods =

Article ID: 819602

Article Last Modified on 5/16/2007

-

APPLIES TO


 * Microsoft Visual C# .NET 2003 Standard Edition
 * Microsoft Visual J++ 6.0 Standard Edition

-



SYMPTOMS
You have a Visual J++ Microsoft Windows application project that has a class that implements the following mouse event methods:
 * MouseMotionListener
 * MouseListener

When you convert your Visual J++ project to a Visual C# .NET project by using the Java Language Conversion Assistant (JLCA) tool, you receive the following compilation error message:

'System.EventArgs' does not contain a definition for 'X'

'System.EventArgs' does not contain a definition for 'Y'



CAUSE
When JLCA converts your Visual J++ project, it converts all the MouseEvent class objects to System.EventArgs class objects. The problem that is described in the &quot;Symptoms&quot; section occurs because the System.EventArgs class does not have properties named X and Y. Therefore, you receive compilation errors.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce the Behavior
 Start Visual J++ 6.0. On the File menu, click New Project. Expand Visual J++ Projects, click Applications, and then click Windows Application in the right pane. Name the project MyVJTestApplication, and then click Open.  Replace the existing code with the following sample code for Form1.java: import java.awt.*; import java.awt.event.*;

public class Form1 extends Frame implements MouseListener, MouseMotionListener {    public Form1 {      addWindowListener(new WindowAdapter { public void         windowClosing(WindowEvent e) { System.exit(0); } } ); setSize(300, 200); setTitle(getClass.getName); addMouseListener(this); }  // Implementing the mouse events of MouseListener and MouseMotionListener // If you do not implement these methods you receive compilation errors in VJ++ public void mouseEntered(MouseEvent evt) {    int xCoordinate = evt.getX; int yCoordinate = evt.getY; Graphics graphics = getGraphics; graphics.drawString(&quot;Entered&quot;, 1, 50); }  public void mousePressed(MouseEvent evt) {    int xCoordinate = evt.getX; int yCoordinate = evt.getY; Graphics graphics = getGraphics; graphics.drawString(&quot;Pressed&quot;, 1, 50); }  public void mouseReleased(MouseEvent evt) {    int xCoordinate = evt.getX; int yCoordinate = evt.getY; Graphics graphics = getGraphics; graphics.drawString(&quot;Released&quot;, 1, 50); }  public void mouseExited(MouseEvent evt) {    int xCoordinate = evt.getX; int yCoordinate = evt.getY; Graphics graphics = getGraphics; graphics.drawString(&quot;Exited&quot;, 1, 50); }  public void mouseClicked(MouseEvent evt) {    int xCoordinate = evt.getX; int yCoordinate = evt.getY; Graphics graphics = getGraphics; graphics.drawString(&quot;Clicked&quot;, 1, 50); }  public void mouseMoved(MouseEvent evt) {    int xCoordinate = evt.getX; int yCoordinate = evt.getY; Graphics graphics = getGraphics; graphics.drawString(&quot;Clicked&quot;, 1, 50); }  public void mouseDragged(MouseEvent evt) {    int xCoordinate = evt.getX; int yCoordinate = evt.getY; Graphics graphics = getGraphics; graphics.drawString(&quot;Clicked&quot;, 1, 50); }  public static void main(String args[]) { Form1 myForm = new Form1; myForm.show; } }  On the File menu, click Save All.</li> Quit Visual J++.</li> Start Microsoft Visual Studio .NET 2003.</li> On the File menu, point to Open, and then click Convert.</li> In Available Converters, click Java Language Conversion Assistant, and then click OK.</li> Follow the instructions in the JLCA Wizard to convert the Visual J++ project that you created in steps 2 through 6.</li> On the Build menu, click Build Solution.</li></ol>

<div class="references_section">