main method to your Ada Applets so that they can be used as Applets or as Applications.
with java.applet.Applet; use java.applet.Applet; with java.lang.String; use java.lang.String; with java.awt.graphics; use java.awt.graphics; package HelloWorld is type HelloWorld_Obj is new Applet_Obj with null record; type HelloWorld_Ptr is access all HelloWorld_Obj'Class; procedure paint(this : access HelloWorld_Obj; G : Graphics_Ptr); procedure main(Args : java.lang.String.String_Array); end HelloWorld;
Package Body
with interfaces.java; use interfaces.java;
with java.awt.Frame; use java.awt.Frame;
with java.awt.Component; use java.awt.Component;
package body HelloWorld is
procedure paint(this : access HelloWorld_Obj; G : Graphics_Ptr) is
begin
DrawString(G, +"Hello World!", x=>50, y=> 25);
end paint;
procedure main(Args : java.lang.String.String_Array) is
Holder_Frame : Frame_Ptr := new_Frame(+"My Ada Application");
My_Applet : HelloWorld_Ptr := new HelloWorld_Obj;
cResult : Component_Ptr;
begin
Init(My_Applet);
Start(My_Applet);
cResult := Add(Holder_Frame, +"Center", Component_Ptr(My_Applet));
Resize(Holder_Frame, 200,75);
Show(Holder_Frame);
end main;
end HelloWorld;