Link to home
Start Free TrialLog in
Avatar of MarkW
MarkW

asked on

VB & Java

I want to create a Java Applet. Drop it on a VB form. Compile it and have the applet work. Can this be done? And if so how?
Avatar of Jason_G
Jason_G

Hi Mark,
This is about the only thing I could find in MSDN in reference to applets, and it talks about Visual Basic scripting edition.

***************************************************
*Visual Basic, Scripting Edition, and Java Applets*
***************************************************
Visual Basic, Scripting Edition, is yet another implementation of Microsoft Visual Basic;

this version allows developers to write programs—known as scripts—inside an HTML document.

A Visual Basic, Scripting Edition, program can call any public member of a Java applet. For

example, I could create a Java class.

public class Alarm extends Applet
{
    private int m_nVolume;

    public void setVolume(int v)
    {
        m_nVolume = v;
    }
}
I could then include the applet in an HTML document.

<APPLET CODE="Alarm.class" IS=ringer>
Then I could call setVolume from a script.

<SCRIPT language="VBScript">
<!--
Sub setLowVolume
    document.ringer.setVolume 10
End Sub

Sub setHighVolume
    document.ringer.setVolume 100
End Sub
-->
</SCRIPT>
The term document identifies the location of the ringer object, which is part of the web

page. What I’ve done above isn’t COM programming; I’m simply using Visual Basic, Scripting

Edition, to communicate between the web page and the applet. But as you’ll see, this

mechanism is quite useful in connecting Java applets to ActiveX controls.

I hope this helped.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com

ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually IE v3 will work too.