BASIC meet Java


Java and Visual Basic are very different technologies. I'll show you some opportunities with the Jabaco-concept in both worlds:

Contents

DoEvents

You'll find a fractal-sample in your Jabaco-Installation. Your PC is busy during the calculation of a fractal. Maybe the user would like to stop the calculation before it is finished? The normal way to do that with Java is: create a thread and write several synchronizations. With Jabaco you are able to force the event processing of Java. Exactly like Visual Basic with the command "DoEvents". It isn't necessary to create a Thread but it is also possible with Jabaco.

Basic-Wrapper

There are so many VB6-functions at Jabaco - i couldn't list them all. Some general informations: Jabaco is using Swing for the GUI-Controls by default. The Jabaco-Framework includes several Wrapper-Classes to make it more compliant with Visual Basic. You'll retrieve the Java-Control through the Parent-Property of each Framework-Class. Not all controls could be inherited - that's the only reason for this solution. Use this property to enhance the functionality of the control. The better way is to change it inside the Jabaco-Framework (Open Source). You are able to use several alternative technologies like AWT, SWT, Jami (QT), Wx4J (Widgets)

Error-Handling

Jabaco supports Error-Handling like Visual Basic (On Error Resume Next, On Error Goto Label, On Error Goto 0) - maybe it will support the try-catch method of Java in future. You have to be careful with the "Resume Next"-method. Sun implemented a very strong class-verification for security-reasons. That's why i excluded the Error-Handling for the definition of variables. The errors couldn't be catched in a var-definition at the moment.

Reflections

You are able to use the Java-Reflection-API, or you could do it a little bit simpler like Visual Basic with CallByName, or define your var as Variant and use the Jabaco-'unknown calls' to invoke a method.

Event-Handling

If you would like to receive Events in Java - you have to do that with the observer-pattern. You could use this pattern with Jabaco - or you do declare an event like Visual Basic and inform the observer by calling the "RaiseEvent"-Command.

GoTo-Statement

Use it or hate it - the only thing i would like to say: it is possible with Java bytecode and it is a feature of Jabaco :whistling:

VB-Properties

Don't like the Java-"set, get, is"-concept? Jabaco supports properties - i added a prefix for the Java-methods to make this possible and to make Jabaco more compliant to Visual Basic.

Platform independent

Not possible with Visual Basic, but a great Feature of Java and Jabaco. With Java you are able to use external native-librarys through the JNI. You are also able to use the JNI with Jabaco, or make it a bit simpler and use it VB-like with only one declaration with the WinAPI-Attribute.

Threading

Not possible with Visual Basic, but a great Feature of Java and Jabaco.

Retrieved from "http://www.jabaco.org/wiki/BASIC_meet_Java"

This page has been accessed 5,108 times. This page was last modified on 9 December 2008, at 23:13.


This page has been accessed 5,108 times. This page was last modified on 9 December 2008, at 23:13.