Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

How do I add an applet to my form instead of a jframe

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
Code
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);

Magic line being
Code
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

Current code
Code
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);
       }


I tried converting the applet into a .NET control since from what I saw on the docs, a applet has to be a control because frame or JForm.add takes a control as a parameter.
Code
Control c = (Control)classLoader.loadClass("client").newInstance();

But that threw me this error
[Image: unknown.png]
The error tells you everything you need to know.
You're trying to cast an object of type "client" to Control.
On another note, Jagex added some code that makes the client fail to load if the size hasn't been set already, it'll throw an exception
[Image: Syr3DlV.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by going clearJan 16, 2021 12:16 PM 2 131 Jan 16, 2021 12:16 PM
Last Post: HFDone
[Java] by Quality_k1nGMay 26, 2018 09:20 AM 1 119 May 26, 2018 09:20 AM
Last Post: .kr.
[Java] by Johndoe27328May 9, 2017 03:08 PM 7 1,240 May 9, 2017 03:08 PM
Last Post: SIM-429621