This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,899 Users
  • 2,269,649 Discussions
  • 7,916,821 Comments

Discussions

trying to put java awt into c# app

Hi, not sure if this is the place to post, mod please move it necessary...
The problem here is that i am trying to put a java panel into a C# winform.
I am using the IKVM to convert my java class to a dll and the C# program is referencing it.

Here are the codes:
for java:
// JavaComponent.java
import java.awt.*;
import java.awt.event.*;

public class JavaComponent extends Panel {
   public TextField javaTextBox;
   Button btn;

   public JavaComponent() {
      setSize(400, 100);
      setLayout(new GridLayout());
      add(new Label("JavaComponent: ");
      javaTextBox = new TextField(30);
      btn = new Button("Send");
      add(javaTextBox);
      add(btn);
   }

   public void addActionListener(ActionListener l)
{
   btn.addActionListener()l;
}
}
For C#
JavaComponent jc = new JavaComponent();
jc.setVisible(true);
The C# program compiles without errors but when runing up, it does not show the awt and gives an error of java.Lang.ClassNotFoundException occured in IKVM.Runtime.dll,
System.IO.DirectoryNotFoundException in mscorlib.dll
java.Lang.ClassNotFoundException occured in IKVM.OpenJDK.Core.dll

Can anyone help?
This discussion has been closed.