Click here to Skip to main content
15,902,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
So I am working with a project that involves ikvm

Now it works great and everything until I realized I can't design and cuztomize the JFrame. So what I wanted to do was to, instead of adding the applet to a JFrame, add it to a Windows Form. I am not sure if this ikvm allows that

Because with Java you would just
Java
JFrame frame = new JFrame("OSLoader");
frame.setSize(763, 514);
frame.setPreferredSize(new Dimension (763, 514));
frame.pack();
frame.setVisible(true);
Applet applet = (Applet)classLoader.loadClass("client").newInstance();
frame.add(applet);


The magic line being
frame.add(applet);


How do I add the applet to a Windows form? Maybe inside a panel or something. The jar file I am using (if it's even needed for this) is this one, a Runescape jar file


Current code
C#
private void BtnRun_Click(object sender, EventArgs e)
        {
            //Create an applet
            //Instead of adding that applet to a JForm, add it to a panel or a WinForms Form

            JFrame frame = new JFrame("OSLoader");

            Form aForm = new Form();
            aForm.Width = 514;
            aForm.Height = 763;
            aForm.Visible = true;

            frame.setSize(763, 514);
            frame.setPreferredSize(new Dimension (763, 514));
            frame.pack();
            frame.setVisible(true);
            URLClassLoader classLoader = new URLClassLoader(new URL[] {
                new URL("file:gamepack.jar")});

            Applet applet = (Applet)classLoader.loadClass("client").newInstance();

            //applet.setStub(stub);
            applet.setSize(new Dimension(763, 514));
            //applet.init();
            applet.start();
            frame.add(applet);
            frame.pack();
            frame.setDefaultCloseOperation(3);
        }


What I have tried:

I've tried looking through the docs, and also using the SetParent invoke
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900