Microsoft KB Archive/819604

= PRB: You Receive Compilation Errors in a Visual J++ Windows Application That JLCA Converts by Using the getClick Method =

Article ID: 819604

Article Last Modified on 5/16/2007

-

APPLIES TO


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

-





SYMPTOMS
After you convert a Visual J++ project to a Visual C# .NET project by using Java Language Conversion Assistant (JLCA), you receive the following error message during compilation of the generated Visual C# .NET project:

The keyword new is required on 'ClassName.Click' because it hides inherited member 'System.Windows.Forms.Control.Click'

This error occurs when the Visual J++ project contains a java.awt.Frame derived class and a getClick method.



CAUSE
While converting the Visual J++ project to a Visual C# .NET project, JLCA converts the getClick method to a Click property. Because the generated Visual C# .NET class is derived from the System.Windows.Forms.Form class (which has a Click property), you receive the error message.



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. On the New tab, expand Visual J++ Projects, and then expand Applications. In the right pane, click Windows Application. Name the project by typing MyVJTestWindowsApplication, type the Location as C:\ , and then click Open. In Project Explorer, right-click MyVJTestWindowsApplication, point to Add, and then click Add Class.</li> Name the class file by typing CloseableFrame.java, and then click Open.</li>  Replace the existing code with the following sample code: package CloseableFramePackage; import java.awt.*; import java.awt.event.*;

public class CloseableFrame extends Frame { public CloseableFrame {     addWindowListener(new WindowAdapter { public void         windowClosing(WindowEvent e) { System.exit(0); } } ); setSize(300, 200); setTitle(getClass.getName); } } </li> In Project Explorer, right-click Form1.java, and then click Rename.</li> Type EventQueueTest.java as the new name for Form1.java.</li> In Project Explorer, right-click EventQueueTest.java, and then click View Code.</li>  Replace the existing code with the following sample code: import java.awt.*; import java.awt.event.*; import CloseableFramePackage.*;

public class EventQueueTest extends CloseableFrame { public void run { displayPrompt(&quot;Please click on a point&quot;); Point myPoint = getClick; displayPrompt(&quot;Please click on another point&quot;); Point myAnotherPoint = getClick; Graphics myGraphObj = getGraphics; myGraphObj.translate(getInsets.left, getInsets.top); myGraphObj.drawLine(myPoint.x, myPoint.y, myAnotherPoint.x, myAnotherPoint.y); displayPrompt(&quot;Done!&quot;); }

public void displayPrompt(String s)  {  Graphics myGraphObj = getGraphics; myGraphObj.translate(getInsets.left, getInsets.top); myGraphObj.clearRect(0, 0, getSize.width, 50); myGraphObj.drawString(s, 0, 30); }

public Point getClick { EventQueue eventQ = Toolkit.getDefaultToolkit .getSystemEventQueue; while (true) { try { AWTEvent myEvent = eventQ.getNextEvent; if (myEvent.getID == MouseEvent.MOUSE_CLICKED) { MouseEvent mouseEvent = (MouseEvent)myEvent; Point myPoint = mouseEvent.getPoint; Graphics myGraphObj = getGraphics; myGraphObj.translate(getInsets.left, getInsets.top); myGraphObj.drawOval(myPoint.x - 2, myPoint.y - 2, 4, 4); return myPoint; }        }         catch(InterruptedException e)         {} }  }

public static void main(String[] args) { EventQueueTest myEventQueueTest = new EventQueueTest; myEventQueueTest.show; myEventQueueTest.run; } } </li> On the File menu, click Save All, and then quit Visual J++.</li> Start Visual Studio .NET 2003.</li> On the File menu, point to Open, and then click Convert.</li> Click to select the Java Language Conversion Assistant check box under the Available Converters section.</li> Click to select the Create new solution check box, and then click OK.</li> Follow the instructions in Java Language Conversion Assistant wizard to convert the Visual J++ project.</li> On the Build menu, click Build Solution.

You receive the compilation error that is mentioned in the &quot;Symptoms&quot; section of this article.</li></ol>

<div class="references_section">